How to Add Javascript to Joomla Articles

Note: This post applies to Joomla 1.5. If you have Joomla 1.6, then please contact us, as the procedure is different.

Nearly every day we are contacted by one or more of our customers who tell us the following:

I have tried to add Javascript code to my website, but it doesn’t work. It seems that Joomla strips or escapes the Javascript code when I save it. Even when I go to HTML mode in the editor, it’s still doesn’t work. Is there a way to add Javascript code to my website without paying you any money?

Here’s our answer:

Fortunately for you and unfortunately for us, there is a way to add Javascript to your articles without using our services. All you need to do is the following: Go to Site->User Manager. Click on your username, and then under Parameters on the right side pane, choose “No Editor” from the “User Editor” field. This will ensure that the HTML will neither strip nor escape your Javascript code.

Now that you know how to fix it, let us tell you why this happens. It happens because the editor tries to prevent users from creating content that may have malicious content. If you ask us, we think that by default all administrators should be allowed to add Javascript code to their websites without a problem.

No comments yet.

Leave a comment