I have a variable containing javascript code which looks like this:

$this->item->test_script = '<script type = "text/javascript">code for url</script>'

However when I view it in inspect element, the script tags were eliminated, thus not showing the link I tried to display in the article. Is there a way to escape script tags so as for them not to be removed by joomla?

  • How are you adding this code to Joomla? Where are you adding it?
    – TryHarder
    Mar 6, 2015 at 22:09

2 Answers 2


If you are adding this script code in the editor then there are some settings available in the editor plugin, where you can set whether script is allowed or not in the editor.

In case there is some other way using which this variable is getting added then please specify that.


Why don't you use the Joomla methods for adding scripts?
Like this: Adding JavaScript and CSS to the page

Or encode and later decode the var with php

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.