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 =)

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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