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 Answer 1

  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, 2014 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, 2014 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, 2014 at 10:52
  • How about for drupal 8? Jun 7, 2017 at 19:21
  • Is this a Good Practice ? Jun 20, 2017 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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