DirkPersky / typo3-dp_cookieconsent

TYPO3 Extension: Enable a cookie consent box. Let you visitors control the usage of cookies and load script or content after a consent. (ePrivacy, TTDSG)
GNU Affero General Public License v3.0
32 stars 27 forks source link

Combination with external resource & inline js #12

Closed in-session closed 5 years ago

in-session commented 5 years ago

Could it be that a combination of the both is not possible?

<script type="text/plain" data-cookieconsent="statistics" data-src="https://s3.tradingview.com/external-embedding/embed-widget-tickers.js">
  {
  "symbols": [
    {
      "title": "GOLD (USD)",
      "proName": "XAUUSD"
    }
  ],
  "colorTheme": "dark",
  "locale": "en"
}
</script> 
DirkPersky commented 5 years ago

Yeah that ist right.

mario-seidel commented 5 years ago

I already tested the combination of internal js with an external source. And with this, you could first load the resource and then add the inner HTML as callback, which will be called if source was loaded. But imho this is not a good approach, because its a little misuse of the script tag.

Another option is to add an ID to the script element created when cookies are accepted so that you can add an event listener to that element. On the other hand, you depend on the build and can get an error if the item is not available.

In summary, a good solution for the existing callback function after loading the exteral script would be really nice.

mario-seidel commented 5 years ago

:+1: