cookies-enabler
cookies-enabler copied to clipboard
Problems with Google Maps Javascript API?
Hi, I'm developing a new website using cookies-enabler and it work pretty well, as usual for youtube iframes, Google analytics and Google recaptcha scripts.
But in the contact page of this website I need to use the Google Javascript API to create a map with two marker and other personalizations and it won't work with cookies-enabler.
I've also tried to use postscribe as described in the documentation, but nothig, it won't works.
This is the code I'm using:
`
| | | | | | |
' | +'Lorem ipsum dolor sit amet ' | +''+'Ok'+'
', | | eventScroll: false, | scrollOffset: 200, | | clickOutside: false, | | cookieName: 'ce-cookie', | cookieDuration: '365', | | iframesPlaceholder: true, | iframesPlaceholderHTML: | 'Lorem ipsum dolor sit amet ' | +'Ok' | +'
', | iframesPlaceholderClass: 'ce-iframe-placeholder', | | // Callbacks | onEnable: '', | onDismiss: '', | onDisable: '' | }); | ` The chrome console says:Uncaught ReferenceError: google is not defined at initialize (contatti.php:352)
Anyone has any suggestion to fix this problem, please?
Try adding type="text/plain" to your script tag. Without it the script would be executed on the initial DOM load
Il giorno mer 18 mar 2020 alle 10:50 beke64 [email protected] ha scritto:
Hi, I'm developing a new website using cookies-enabler and it work pretty well, as usual for youtube iframes, Google analytics and Google recaptcha scripts.
But in the contact page of this website I need to use the Google Javascript API to create a map with two marker and other personalizations and it won't work with cookies-enabler.
I've also tried to use postscribe as described in the documentation, but nothig, it won't works.
This is the code I'm using:
`
| | | | | | |
Lorem ipsum dolor sit amet ' | +''+'cookie policy'+' http://cookie-policy.php. ' | +'
Lorem ipsum dolor sit amet ' | +''+'Ok'+' <#m_-2784414468120562279_> ', | | eventScroll: false, | scrollOffset: 200, | | clickOutside: false, | | cookieName: 'ce-cookie', | cookieDuration: '365', | | iframesPlaceholder: true, | iframesPlaceholderHTML: | '
Lorem ipsum dolor sit amet ' | +'Ok <#m_-2784414468120562279_>' | +' ', | iframesPlaceholderClass: 'ce-iframe-placeholder', | | // Callbacks | onEnable: '', | onDismiss: '', | onDisable: '' | }); | ` The chrome console says:
Uncaught ReferenceError: google is not defined at initialize (contatti.php:352)
Row 352 is
var latlngSede = new google.maps.LatLng(43.75666,11.24955);
Anyone has any suggestion to fix this problem, please?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nicholasruggeri/cookies-enabler/issues/52, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOGUHG4LIUGRDTBRMJ7AKTRICKN3ANCNFSM4LONFL5Q .
-- Gianmarco Simone ⚛️http://www.actreact.io http://www.actreact.io
Thanks for the answer Gianmarco. I have done it, but nothing changes...
` | | |
| var initialize = function() { | ... `
Please try to share a live environment or a complete reproduction.
Sure, here it is: http://www.influsso.it/googlemap/
The upper grey box is a youtube iframe embedded, perfectly working, and the bottom grey box is the googlemap
I see you are using a module version of postscribe ( notice the import statements in the postscribe.js file ). You should use a browser build like this one https://github.com/krux/postscribe#browser
Thanks Gianmarco, now it works!!! The map doesn't reload automatically like the iframe, anyway, do you think this can be fixed? I mean that after clicking on the ce-banner I need to manually reload the page to see the Google map