0

I need to insert a javascript code in a textarea field of a node. This one:

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

The problem is that this line becomes:

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

The real source value: http://www.avaibook.com/js/avaibook.js is replaced by about:blank.

I already know that the pathologic module is the cause (if I disable it it works fine), but can't disable since I need it for other purposes.

Is there any way to avoid this?

1 Answer 1

1

You can try adding Javascript in your template files by using

<?php
drupal_add_js(drupal_get_path('theme', 'mytheme') .'/mytheme.js');
?>

also this works in modules etc as explained here: http://drupal.org/node/304255

sometimes it is comfortable to add whole JavaScript inline:

drupal_add_js('jQuery(document).ready(function(){   
   // Your stuff
   })      
', 'inline');

Hope that helps avoid that module behaviour.

4
  • since the js shows a booking calendar I need to put the script in the middle the body text, then I'd like to have the option to insert it directly in this field.
    – chefnelone
    Oct 1, 2012 at 8:09
  • But did you try to add your script inline as i suggested ? That way you are avoiding referencing a source.
    – NenadP
    Oct 1, 2012 at 8:31
  • I haven't see your lines for adding it inline. It works, thanks
    – chefnelone
    Oct 1, 2012 at 8:36
  • I added it 1 minute after i submitted answer, probably that's the reason :)
    – NenadP
    Oct 1, 2012 at 8:41

Your Answer

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

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