Curle
b8da68566f
All the files here were made by running the command dotnet new webApp -o obsidian --no-https HTTPS will be enforced net<->user by IIS, not by the web app itself.
26 lines
994 B
Plaintext
26 lines
994 B
Plaintext
@using Microsoft.AspNetCore.Http.Features
|
|
|
|
@{
|
|
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
|
|
var showBanner = !consentFeature?.CanTrack ?? false;
|
|
var cookieString = consentFeature?.CreateConsentCookie();
|
|
}
|
|
|
|
@if (showBanner)
|
|
{
|
|
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
|
|
Use this space to summarize your privacy and cookie use policy. <a asp-page="/Privacy">Learn More</a>.
|
|
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
|
|
<span aria-hidden="true">Accept</span>
|
|
</button>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
|
|
button.addEventListener("click", function (event) {
|
|
document.cookie = button.dataset.cookieString;
|
|
}, false);
|
|
})();
|
|
</script>
|
|
}
|