Horje

How to add An <iframe> with extra restrictions - HTML sandbox Attribute

The "Get date and time" button will run a script in the inline frame. Since the sandbox attribute is set, the content of the inline frame is not allowed to run scripts. You can add "allow-scripts" to the sandbox attribute, to allow the JavaScript to run.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The iframe sandbox attribute</h1>

<iframe src="demo_iframe_sandbox.htm" sandbox>
  <p>Your browser does not support iframes.</p>
</iframe>

<p>The "Get date and time" button will run a script in the inline frame.</p>
<p>Since the sandbox attribute is set, the content of the inline frame is not allowed to run scripts.</p>
<p>You can add "allow-scripts" to the sandbox attribute, to allow the JavaScript to run.</p>

</body>
</html>

Output should be:

How to add An <iframe> with extra restrictions - HTML sandbox Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin