I'm trying to utilize some pre-built code to display data in a Block. Specifically, show a crude oil price quote in a block.

On oil-price.net, they give you code to embed on an HTML site to display a price quote. So how the heck do i get this on a Block?...it looks like this:

enter image description here

This is what they give to embed...

<script type="text/javascript" src="http://www.oil-price.net/widgets/brent_crude_price_large/gen.php?lang=en"> </script> <noscript> To get the BRENT <a href="http://www.oil-price.net/dashboard.php?lang=en#brent_crude_price_large">oil price</a>, please enable Javascript. </noscript>

  1. Create a block (navigate to Structure -> Blocks -> Add block or http://example.com/admin/structure/block/add)
  2. Make sure you set the Text format of the block to "Full Html"
  3. Paste in your embed code

Please be aware of the security risks involved http://example.com/admin/help/filter, https://drupal.org/node/213156

  • +1 for the security risks. @Dubya - it means "don't do it, unless you really have to". – Mołot Jan 30 '14 at 8:00
  • @undersound - thx. Yes i had tried that, but the wysiwyg editor strips all the <script> tag info out. Yes have it set to Full HTML. – Dubya Feb 25 '14 at 10:46
  • Ok, found the solution, in CKEditor settings: Go to the "Advanced Options" section of your CKEditor profile and add the following string into the text area: config.allowedContent = true; – Dubya Feb 25 '14 at 10:52
  • How about for drupal 8? – Prerit Mohan Jun 7 '17 at 19:21
  • Is this a Good Practice ? – logeshvaran Jun 20 '17 at 8:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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