0

I have created a basic page. Inserted the following tripAdvisor your rating widget code in that which contains some javascript. Used Full HTML formatting. But instead of displaying the rating widget it's just displaying the TripAdvisor logo. How can we insert javascript in body?

<div id="TA_cdsratingsonlywide929" class="TA_cdsratingsonlywide"><ul id="4tBLqbUxyNxV" class="TA_links b9a34Zb66"><li id="UjhOoNfy" class="GDLP2q"><a target="_blank" href="https://www.tripadvisor.com/"><img src="https://www.tripadvisor.com/img/cdsi/img2/branding/tripadvisor_logo_transp_340x80-18034-2.png" alt="TripAdvisor"/></a></li></ul></div><script async src="https://www.jscache.com/wejs?wtype=cdsratingsonlywide&amp;uniq=929&amp;locationId=8678313&amp;lang=en_US&amp;border=true&amp;backgroundColor=gray&amp;display_version=2" data-loadtrk onload="this.loadtrk=true"></script>

Edit: I have tested the same code on another Drupal 8 Website and it's working without any issue in that.

The site on which the code is not working was upgraded to Drupal 8 from Drupal 7 and it's also configured on cloudflare. I tried to put cloudflare on development mode and also disabled the AdvAgg module but thats still not working.

Is there any settings in Drupal 8 which can disable javascripts scripts in Body field?

0

Most likely , your FULL HTML content authoring text format settings are limiting the markup you can use, stripping out the script (that's default behavior).

You can either: 1. Modify the settings for the text format to not restrict markup 2. Create a new text format, without any of the filter options enabled; then switch the format on the body field in which you want to insert the script.

If these options still fail, you may have a theme where a preprocess hook or twig filter is stripping out the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.