Tuesday, July 14, 2009

Is javasript allowed in blogger posts?

can we use javascript in blogger post? Does blogger support javascript in their posts like in template?
Is javasript allowed in blogger posts?
Yes, you can. However, you have to change an option for this to work. Under Settings, go to Formatting, and set Convert line breaks to No.





The downside to this, is you must use %26lt;br%26gt; for newlines, so the blog composer is no longer a What You See is What You Get editor.





I used this technique to put google ads on my posts. Plus, I tested this with the simple code:





%26lt;script%26gt;


alert("hello");


%26lt;/script%26gt;





When Convert line breaks is set to Yes, your source code will be: %26lt;script%26gt;
alert("hello");
%26lt;/script%26gt;, which is not what you want (and the script won't run)





Hope that helps.

No comments:

Post a Comment