Comments (5)
Good point, we did not test with restrictive CSP yet. Thank you for bringing that up. Of course we need to support that.
Current situation
We have some voodoo for <script>
s in place:
- we let a new DOM-object parse the HTML from the
inject
setting - with any
<script>
in there (which will be inactive due to being inserted with .innerHTML) we extract it and add it one by one (to the end of the<body>
)
Here's the relevant section
extension-cookieman/Resources/Public/Js/cookieman.js
Lines 99 to 124 in 0ea02dc
Found a problem
I think I just forgot to copy all of the <script>
's attributes to the newly inserted one! So e.g. any src= would not be transferred!
If we do that correctly, I feel we should be ok as we would do then exactly as many tracking objects inject itself:
(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();
Tests
I'd like to add that also to the automated tests.
Are you using Content-Security-Policy: script-src 'self'
?
Thing is that this also affects the example themes: you cannot use onclick=...
with that ;)
reSt docs
Oh, I would be very happy to have the docs .rst'ed and would gladly switch to it:) I just don't have any experience with it yet and feared that our multi-branch-approach would be a bit difiicult to set up with https://docs.typo3.org/ - it would be great if you could get us started with that. Thank you, Sebastian!
from extension-cookieman.
I pushed a JavaScript change that should fix inclusion of script tags.
Could you please review this change in cookieman[.min].js?
from extension-cookieman.
Great! The external JavaScript sources of my Matomo demo are now injected in the HTML and recognized.
On some pages I now get error messages in the browser console that _paq.push() was used but Matomo tracker was not initialized before the matomo.js file was loaded.
But this is a different issue that needs to be fixed by myself.
from extension-cookieman.
On some pages I now get error messages in the browser console that
_paq.push() was used but Matomo tracker was not initialized before the matomo.js file was loaded.
But this is a different issue that needs to be fixed by myself.
Normally you would attach a function to the script like <script onload="callAllPaq_s()"...>
but as I just learned inline JavaScript wouldn't work with CSP: script-src
.
It would be nice if cookieman could provide an event so that you could do:
cookieman.TrackingObjects.Matomo.injects.scripts[0].onload = function() { _pag.push() }
That would be possible and not too hard to implement.
from extension-cookieman.
I changed the API a bit from my initial idea: https://github.com/dmind-gmbh/extension-cookieman#cookiemanonscriptloadedstring-trackingobjectkey-int-scriptid-function-callback-void
Does that fit your use case?
from extension-cookieman.
Related Issues (20)
- Documentation improvements - feedback HOT 1
- Destroy cookie CookieConsent if is older than some specified date HOT 2
- Why using void return in themes? HOT 2
- Removal of cookies is not complete due to missing "/" path HOT 1
- typo3/cms-composer-installers:^4 compatibility will need some work HOT 4
- Add test if the modal window can be displayed HOT 7
- group.respectDnt = 0 is not respected HOT 4
- Too few arguments to function Dmind\Cookieman\DataProcessing\TypoScriptSettingsProcessor::__construct(), 0 passed in HOT 2
- EditorConfig sets wrong indent size HOT 5
- Logo in modal header HOT 2
- Class btn-small doesn't exist in Bootstrap 3
- Google Consent Mode Integration HOT 2
- CookieConsent cookie expires only after 1 week HOT 4
- Accessibility: Fix headline hierarchie in modal HOT 1
- TYPO3 12 compatibility HOT 17
- htmlCookieRemovalPattern for GA4 tag HOT 3
- Could it be possible to include bootstrap js in extension HOT 1
- Option to refresh page if user accept all cookies HOT 2
- Cookies get set on page refresh despite preferences HOT 2
- Setting: Open with a time delay HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-cookieman.