Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<title>Test showPicker() in an iframe</title>
<script type=module>
import inputTypes from "./../input-types.js";
const urlParams = new URLSearchParams(location.search);
const documentDomain = urlParams.get('documentDomain');
if (documentDomain) {
document.domain = documentDomain;
}
let securityErrors = [];
for (const inputType of inputTypes) {
const input = document.createElement("input");
input.setAttribute("type", inputType);
try {
input.showPicker();
} catch (error) {
if (error instanceof DOMException && error.name == 'SecurityError') {
securityErrors.push(inputType);
}
}
}
parent.postMessage(securityErrors.join(','), "*");
</script>