Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie Consent may cause JavaScript error #4762

Closed
1 of 2 tasks
bdukes opened this issue Jul 28, 2021 · 5 comments · Fixed by #4763
Closed
1 of 2 tasks

Cookie Consent may cause JavaScript error #4762

bdukes opened this issue Jul 28, 2021 · 5 comments · Fixed by #4763

Comments

@bdukes
Copy link
Contributor

bdukes commented Jul 28, 2021

Description of bug

DNN's cookie consent script uses dnn.getVar to read its options. However, it does not ensure that dnn.js is included on the page, so in scenarios where nothing else on the page requests dnn.js the functionality will fail.

Steps to reproduce

  1. Use a minimal theme
  2. Turn on cookie consent
  3. See error

Affected version

  • 10.00.00 alpha build
  • 09.09.00 latest supported release
@Tychodewaard
Copy link
Contributor

@bdukes Great one! Do you know of a workaround until it is released? How do I request dnn.js for instance?
Just adding

<script src="/js/dnn.js"></script> to the page header is not enough.

@bdukes
Copy link
Contributor Author

bdukes commented Sep 1, 2021

@Tychodewaard I added this to a control that was included in all of the theme controls:

<script runat="server">
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
    MyBase.OnLoad(e)
    DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RegisterClientReference(Page, DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn)
End Sub
</script>

@Tychodewaard
Copy link
Contributor

Yeah, I created a work around in the past as well, involving registry of a component in the theme.
Thing is that for this particular client, I don't have FTP access and they use a commercial theme.
So, was hoping to include some script in the head of a module... Just for a temp fix because we will be upgrading before the end of the year.

@bdukes
Copy link
Contributor Author

bdukes commented Sep 2, 2021

I would think just including /js/dnn.js should work, maybe it needs to be included earlier than via a module header (e.g. in the page header)?

@Tychodewaard
Copy link
Contributor

I tried <script src="/js/dnn.js"></script>
in the page header and in a module header...neither revives the cookie consent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants