Files
gotenberg/test/integration/testdata/feature-rich-html/index.html
Daniel Moran 82401bdfdd feat(chromium): add support for emulated media features in Chromium (#1474)
Closes https://github.com/gotenberg/gotenberg/issues/1460

It can be easier to print a "clean" PDF of some pages if you emulate
media features like `prefers-reduced-motion`. Add support for that
emulation.
2026-02-17 20:16:28 +01:00

89 lines
2.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- net::ERR_FILE_NOT_FOUND -->
<link rel="stylesheet" type="text/css" href="doesnotexist.css" />
<!-- net::ERR_CONNECTION_REFUSED -->
<link
rel="stylesheet"
type="text/css"
href="http://localhost:100/style.css"
/>
<!-- 400 Bad Request -->
<link
rel="stylesheet"
type="text/css"
href="https://gethttpstatus.com/400"
/>
<title>Feature Rich HTML</title>
<style>
@media print {
#screen {
display: none;
}
}
@media screen {
#print {
display: none;
}
}
#reduced-motion {
display: none;
}
@media (prefers-reduced-motion: reduce) {
#reduced-motion {
display: block;
}
}
</style>
</head>
<body>
<p id="wait" style="display: none">
Wait delay > 2 seconds or expression window globalVar === 'ready' returns
true.
</p>
<p id="print">Emulated media type is 'print'.</p>
<p id="screen">Emulated media type is 'screen'.</p>
<p id="reduced-motion">Prefers reduced motion.</p>
<p id="javascript" style="display: none">JavaScript is enabled.</p>
<iframe src="/etc/passwd"></iframe>
<iframe src="\\localhost/etc/passwd"></iframe>
<script type="application/javascript">
var globalVar = "notReady";
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
delay(2000).then(() => {
const waitText = document.getElementById("wait");
waitText.style.display = "contents";
window.globalVar = "ready";
const newText = document.createElement("p");
newText.id = "wait-selector";
newText.textContent = "Wait on selector returns true.";
waitText.parentNode.insertBefore(newText, waitText);
});
</script>
<script type="application/javascript">
document.getElementById("javascript").style.display = "contents";
</script>
<script type="application/javascript">
console.log("a simple message");
console.debug("a debug message");
console.warn("a warning message");
console.error("an error message");
</script>
<script type="application/javascript">
throw new Error("Exception 1");
</script>
<script type="application/javascript">
throw new Error("Exception 2");
</script>
</body>
</html>