Forum Discussion
Not sure if you are trying to do this in a message post or not, but Lithium is pretty restrictive about allowing that kind of stuff in a message post, mainly to prevent cross-site scripting (XSS) attacks.
For this type of an itegration, where javascript needs to be added to the page, you'll most likley want to use Lithium Studio to build some custom components that add the chat functionality. You can take a look at some of the code samples on the dev nation main page to see some example components.
If that's what you are currently doing, great. It looks like using the html-escaped colon might be the problem:
<a href="javascript:webISChatPop
You should use a non-escaped colon instead:
<a href="javascript:webISChatPop('Template=template_id');">
A little better would be using the onclick attribute:
<a href="#" onclick="webISChatPop('Template=template_id'); return false;">
Even better than that, use javascript in your .js file that adds an onclick event to your hyperlink -- say your markup was this:
<a href="#" id="chat-link-1">my link</a>
Then you could add something like this in your .js file:
var startChat = new function() { webISChatPop('Template=template_id'); }; var myLink = document.getElementById("chat-link-1"); if (myLink.addEventListener) { // all browsers except IE before version 9 myLink.addEventListener("click", startChat, false); } else { if (myLink.attachEvent) { // IE before version 9 myLink.attachEvent("click", startChat); } }
That will dynamically add an "onclick" event to the link. We use freemarker and JQuery at Lithium -- if you want to add a script via a custom freemarker component, we give you the <@liaAddScript> directive which you can use in custom components to add javascript that will run near the bottom of the page -- here is a code snippet that adds the link, then adds an onclick event using jquery:
<#assign image_alt_text = text.format("custom.chat.image.alt_text") /> <a href="#" id="chat-link-1"><img src="http://as00.estara.com/webcare/public/linkimage.php?ulbid=value_of_our_ulbid" border="0" alt="${image_alt_text}"/></a> <@liaAddScript> ;(function($) { $("#chat-link-1").click(function(event) { webISChatPop('Template=template_id'); return false; }); })(LITHIUM.jQuery); </@liaAddScript>
I hope that helps!
-Doug
Hi Doug,
Many thanks for your reply. I also work on the creation of a module via Studio with a colleague. I agree with you, this seems to be a better way to embed that kind of link. I will keep you posted when we are done.
Best regards,
Michaël.