dnn.js not included on the page when cookie consent is enabled
See original GitHub issueDescription of bug
The new cookie consent functionality released with DNN 9.3.1 depends on the window.dnn object being available which is created by dnn.js. However, when not using a skinobject that includes dnn.js on the page (or manually registering it), dnn.js is not included on the page and the cookie consent functionality breaks.
Relevant code:
$(window).on('load', function () {
window.cookieconsentoptions = window.cookieconsentoptions || {};
window.cookieconsentoptions.content = {
message: window.dnn.getVar('cc_message'),
dismiss: window.dnn.getVar('cc_dismiss'),
link: window.dnn.getVar('cc_link')
}
if (window.dnn.getVar('cc_morelink') != '') {
window.cookieconsentoptions.content.href = window.dnn.getVar('cc_morelink')
}
if (!window.cookieconsentoptions.palette) {
window.cookieconsentoptions.palette = {
"popup": {
"background": "#000"
},
"button": {
"background": "#f1d600"
}
}
}
window.cookieconsent.initialise(window.cookieconsentoptions);
});
Our current short-term (as in, critical fix) workaround involves including the search skinobject on the page in a hidden div. Less than ideal of course.
Steps to reproduce
List the steps to reproduce the behavior:
- Create a simple empty page skin (no skinobjects that register dnn.js)
- Enable the cookie consent functionality
- Log out (dnn.js is loaded when logged in, into a SuperUser account anyway)
- Cookie consent message does not show
Current result
The cookie consent popup does not show.
Expected result
The cookie consent popup should show.
Screenshots
If applicable, provide screenshots to help explain your problem.
Error log
See above
Additional context
Add any other context about the bug that may be helpful for resolution.
Affected version
- 9.3.1
- 9.2.2
- 9.2.1
- 9.2
- 9.1.1
- 9.1
- 9.0
Affected browser
- Chrome
- Firefox
- Safari
- Internet Explorer
- Edge
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Cookie Consent won't show unless a module has a ...
What should a modify on my SKIN file to enable the Cookie Consent ... was an issue where a needed js file was...
Read more >Identifying DNN Cookies and their Functions
A cookie is a small amount of text data provided to a web browser by a web server. The cookie is then stored...
Read more >Different methods of including JavaScript files in DNN and ...
It depends on how you include your JavaScript files in your modules. If you use the Client Dependency Framework there currently is not...
Read more >Javascript API for Cookie Consent
If set, cookie consent will not be displayed pages defined here. Specify pages using string or RegExp. using a string : '/index.html' (matches...
Read more >Best practices for cookie notices - web.dev
This article discusses how cookie notices can affect performance, performance measurement, and user experience.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue and your workaround fixes the issue by placing that line in the skin’s .ascx file and removing PathNameAlias=“SkinPath”.
Yes, in 9.10.1