80 lines
3.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<title>bootstrap-cookie-banner demo page</title>
</head>
<body>
<div class="container">
<h1 class="mt-5 mb-4"><a href="../">bootstrap-cookie-consent-settings</a> demo page</h1>
<p>This is a modal dialog (cookie banner) and framework to handle the German and EU law (as written by EuGH,
1.10.2019 C-673/17) about cookies in a website. This banner requires Bootstrap.</p>
<h2>Usage</h2>
<h3>Construct</h3>
<p>Initialize the cookie consent framework with the constructor</p>
<p><code>var cookieSettings = new BootstrapCookieConsent()</code></p>
<h3>Show the Dialog</h3>
<p>On a new visit the dialog is shown automatically. For reconfiguration
show the Dialog again with <code>cookieSettings.showDialog()</code>.
</p>
<p>
<a href="javascript:showSettingsDialog()" class="btn btn-primary">Cookie Settings</a>
</p>
<h3>Read the settings</h3>
<p>Read all cookie settings with <code>cookieSettings.getSettings()</code></p>
<div class="card mb-4">
<div class="card-body">
<pre class="mb-0" id="settingsOutput"></pre>
</div>
</div>
<p>Read a specific cookie setting with <code>cookieSettings.getSettings('statistics')</code></p>
<div class="card">
<div class="card-body">
<pre class="mb-0" id="settingsAnalysisOutput"></pre>
</div>
</div>
<h2 class="mt-4">The code of this banner</h2>
<div class="card">
<div class="card-body">
<pre><code>var cookieSettings = new BootstrapCookieConsentSettings({
contentURL: "../cookie-consent-content",
privacyPolicyUrl: "privacy-policy.html",
legalNoticeUrl: "legal-notice.html",
postSelectionCallback: function () {
location.reload() // reload after selection
}
})</code></pre>
</div>
</div>
<h2 class="mt-4">More documentation</h2>
<p class="mb-5"><a href="https://github.com/shaack/bootstrap-cookie-consent-settings">Find more documentation and
the sourcecode on GitHub</a></p>
</div>
<script src="../src/bootstrap-cookie-consent-settings.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
crossorigin="anonymous"></script>
<script>
const cookieSettings = new BootstrapCookieConsentSettings({
contentURL: "../cookie-consent-content",
privacyPolicyUrl: "privacy-policy.html",
legalNoticeUrl: "legal-notice.html",
postSelectionCallback: function () {
location.reload() // reload after selection
}
})
function showSettingsDialog() {
cookieSettings.showDialog()
}
document.getElementById("settingsOutput").innerText = JSON.stringify(cookieSettings.getSettings())
document.getElementById("settingsAnalysisOutput").innerText = cookieSettings.getSettings("statistics")
</script>
</body>
</html>