Drupal – Embed inline Javascript in node body

Recently i have an client who wants to embeded the FormSite form in the a Drupal 6 website. But after i insert the embedded code in the node body with Full HTML or PHP Code filters. Nothing is shown. For example, if i enter the following code in the node body.

...
<script type="text/javascript" src="http://www.example.com/example.js"></script>
...

 

The following code is shown instead

...
<script type="text/javascript" src="about:blank"></script>
...

 

To by pass the Javascript filter, we can use PHP. Rewrite your node body as follow.

...
<script type="text/javascript" src="<?php print 'http://www.example.com/example.js'; ?>"></script>
...

 

It seems that Drupal 7 does not have this problem.

Done =)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.