JavaScript error when cookie message contains newlines / single quotes
-
Hey guys,
Great work on the plugin. Just came across a minor bug.
When the “Customizer > Divi Cookie Consent > Content > Cookie Message” box contains a newline or single quote, the resulting JavaScript is broken and triggers an “Uncaught SyntaxError: Unexpected identifier” error in the console and prevents the consent box from displaying.
I believe the issue lies with this line in the DCC_Markup class:
"message": '<?php echo $dcc_content; ?>',And seems to be fixed by changing it to:
"message": <?php echo json_encode($dcc_content); ?>,Hope that is of use.
Dan
The topic ‘JavaScript error when cookie message contains newlines / single quotes’ is closed to new replies.