Closed (fixed)
Project:
EU Cookie Compliance (GDPR Compliance)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 May 2016 at 18:44 UTC
Updated:
28 May 2018 at 13:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
voj commentedCould you provide more details?
can you open the console of your browser and maybe send a screenshot?
Comment #3
aheredia commentedHi
As a workaround, if they are in different scope try to change the scope to header instead of footer on drupal_add_js in the .module
drupal_add_js(array('eu_cookie_compliance' => $data['variables']), array('type' => 'setting', 'scope' => 'header'));
drupal_add_js(drupal_get_path('module', 'eu_cookie_compliance') . '/js/eu_cookie_compliance.js', array('type' => 'file', 'scope' => 'header'));
Comment #4
aheredia commentedIf they are in the same scope you only need to add more weight to the js file.
Try with the hook_js_alter();
Comment #5
svenryen commentedCan I just confirm, are you using version 2.x or 1.x? We're currently not using 2.x since we're not planning to implement any feature that breaks backwards compatibility. If you're on 2.x, please use a stable release of 1.x instead.
Comment #6
Echofive commentedHello,
I use the version 7.x-2.7 of jQuery Update (1445379855) and the version 7.x-1.14 of EU Cookie Compliance (1400592528) and I have the same error. The version of Jquery is the 1.10 (minified) and it works on the admin theme only.
If I change the scope from "footer" to "header" (lines 124 and 126 of the .module), it shown on the front theme, independently of the value of the setting "Place the pop-up at the top of the website".
So, when jQuery Update is used, the scope must be "header", and I can't explain why at this time.
Kind regards,
Echofive
Comment #7
Echofive commentedHere a patch, for people that need it, to change the scope of the script from "footer" to "header".
Comment #8
svenryen commentedThanks for the patch. I need to do some testing to ensure this fix for jQuery Update doesn't break anything else.
Comment #9
aheredia commentedThe patch at #7 it is exactly what i commented at #3 that was working for me.
So great.
Thanks
Comment #10
svenryen commentedThis has been fixed in dev and soon to be released 1.15 (just need to work through some more issues to clear the queue). There's now an option for the script to be output in the header.
Comment #11
heyyo commentedI think I found the reason why the scope was requested to be in header when using JQuery Update.
The code to replace the library jquery.cookie file by the version 1.4.1 seems to be incorrect.
The key 'data' as far I understood is reserved for Javascript specific settings.
https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
With this modification, I don't need to add the javascript in header.
Comment #12
svenryen commentedThanks for catching this. I checked in XDebug and you're spot on about the syntax. Just a small remark: for d7 contrib we have to use old school array syntax, since D7 also runs on PHP5.3.
Comment #14
svenryen commentedComment #15
heyyo commentedSorry I think this modification wasn't necessary.
Now I had a deeper look, when using the Jquery update module and the last dev, 2 different versions of jquery.cookie is added to the page.
The one of this module and the one provided by jquery update module.
Without the last patch, only the jquery.cookie loaded is the one of the jquery update module.
Because the hooh_library_later of jquery update is runned after the one of this module.
To change this behavior, I suppose we need to increase the weight of this module to one higher than jquery_update if it is installed.
Comment #16
heyyo commentedComment #18
svenryen commentedThanks for the patch. It's added to -dev.
Comment #21
marco.falconi commentedHi,
I'm having the same issue in my live website (https://www.sardegnafuoritraccia.it/) after updating modules and core.
I update also the "EU Cookie Compliance" module to the last dev version but the error remains.
Any suggestion?
Thanks
Comment #22
marco.falconi commentedHi,
I solved the problem exposed in #21.
The problem was the varialbe $scripts printed after the variabile $page_bottom in my html-tpl.php.
Printing $scripts before $page_bottom solved the problem.
Regards