1

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?

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

2 Answers 2

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.

2

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 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.