简体   繁体   English

Javascript 弹出框(警报、确认和提示)是“文档”的一部分还是“浏览器”(客户端)的一部分

[英]Are Javascript popup boxes (Alert, confirm and prompt) part of 'document' or part of 'Browser' (Client)

First of all I apologies if am not aware of similar questions been answered, if so please enlighten me so I can refer and learn (In case they satisfy context of my problem).首先,如果我不知道类似的问题已得到回答,我深表歉意,如果是这样,请启发我,以便我可以参考和学习(如果他们满足我的问题的上下文)。

So, context is my question is completely based on Autoplay Policy Changes .因此,上下文是我的问题完全基于Autoplay Policy Changes Right now this policy imposed to take down unwanted stuff or advertisements to be auto played without user's consent.目前,这项政策是为了删除不需要的内容或广告,以便在未经用户同意的情况下自动播放。 Possibly causing security threats and bandwidth consumption specially on mobile devices.可能会导致安全威胁和带宽消耗,特别是在移动设备上。

The only solution to make it work for some legitimate use is to make user interact with website.使其用于某些合法用途的唯一解决方案是让用户与网站进行交互。 That's cool, I tried to accomplish this by showing an 'alert' box, but it is not satisfying that criteria (Make user interact first).这很酷,我试图通过显示一个“警报”框来实现这一点,但它不满足该标准(首先让用户交互)。 Rather if I add a button to the document body and click on it, then the criteria match I can listen the audio I want to play on page load.相反,如果我在文档正文中添加一个按钮并单击它,那么标准匹配我可以收听我想在页面加载时播放的音频。

So I wonder whether these boxes are alien to DOM ?所以我想知道这些盒子是否与 DOM 不同? or do they belongs to client only?还是他们只属于客户?

I appreciate in advance for any solution which could have been obvious, pro, immature or lay man's knowledge for me to realize.我预先感谢任何可以让我意识到的显而易见的、专业的、不成熟的或外行知识的解决方案。 I am a learner.我是一个学习者。

As JavaScript is Client-Side, the popup boxes are part of the browser (= environment).由于 JavaScript 是客户端,因此弹出框是浏览器(= 环境)的一部分。 That is why the alert() function's complete name is window.alert() .这就是alert()函数的完整名称是window.alert() They are not part of the DOM.它们不是 DOM 的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警报和确认函数是否内置于JavaScript中,或者它们是DOM的一部分? - Are the alert and confirm functions built into JavaScript, or are they part of the DOM? 如何知道模式框(警报,提示,确认...)是否已在javascript中被禁用? - how to know whether modal boxes (alert, prompt, confirm…) have been disabled in javascript? 警报不是Javascript的一部分吗? - alert is not part of Javascript? 警报弹出窗口在C#和JavaScript中进行确认 - Alert popup confirm in c# and javascript 如何故意冻结浏览器窗口(如警报、确认和提示)? - How to freeze browser window intentionally (like alert, confirm and prompt does)? 为什么JavaScript对话框(警告,确认)停止重新绘制页面? - Why does JavaScript dialog boxes (alert, confirm) stop page redrawing? 提示,警告并确认未找到Android WebView中的JavaScript - Prompt, Alert and confirm JavaScript inside a Android WebView not found WKWebView JavaScript警报,提示,确认将不起作用 - WKWebView javascript alert, prompt, confirm won't work 覆盖默认警报和确认框 - Overriding default alert and confirm boxes 函数内的 JavaScript Alert 和 Prompt 未显示在浏览器中 - JavaScript Alert and Prompt inside a function are not displaying in browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM