Adding Javascript To A Block

I tried adding javascript code to a block. This is for our live chat, but it's not working. Nothing shows up. Is there something special I need to do to make this js show up in a block? It worked fine in previous versions.

First off, what version are you using?

What is the code you are inserting?

Did you do a view source to see if the code is there an not executing or whether it's non-existent?

Does your browser error console tell you about any errors?



Not enough information.

[quote name='tbirnseth' timestamp='1310179886' post='116675']

First off, what version are you using?

What is the code you are inserting?

Did you do a view source to see if the code is there an not executing or whether it's non-existent?

Does your browser error console tell you about any errors?



Not enough information.

[/quote]

The latest version 2.2.1. No errors, nothing showing in the browser. And it doesn't matter what the code is, just standard js code.

Did you clear your cache after adding the code to the block? Blocks are now cached (since about 2.1.1) so if the content is changed you will need to clear your cache for the code to show up. If you used the Unique HTML Block then it is not cached (I think) and should show as soon as the block code is available.

[quote name='tbirnseth' timestamp='1310274777' post='116761']

Did you clear your cache after adding the code to the block? Blocks are now cached (since about 2.1.1) so if the content is changed you will need to clear your cache for the code to show up. If you used the Unique HTML Block then it is not cached (I think) and should show as soon as the block code is available.

[/quote]

I don't see “unique” html block in the most recent version, only html block. And this isn't a cache issue. Isn't there anyone out there who has needed to insert javascript to a block.

[quote name='knoxbury' timestamp='1310253477' post='116741']

And it doesn't matter what the code is, just standard js code.

[/quote]



Yes it does. some javascript wizard could jump to help you if they see the code.

Also may be other using the same chat service could share solutions. What chat system is?

[quote name='colortone' timestamp='1310405932' post='116895']

Yes it does. some javascript wizard could jump to help you if they see the code.

Also may be other using the same chat service could share solutions. What chat system is?

[/quote]

I opened a support incident about this and will post the results.