question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dnn.js not included on the page when cookie consent is enabled

See original GitHub issue

Description 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:

  1. Create a simple empty page skin (no skinobjects that register dnn.js)
  2. Enable the cookie consent functionality
  3. Log out (dnn.js is loaded when logged in, into a SuperUser account anyway)
  4. 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. image

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:closed
  • Created 4 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
yog-itcommented, Dec 5, 2019

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”.

0reactions
bdukescommented, Sep 2, 2021

Yes, in 9.10.1

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found