eZ Community » Forums » Developer » Insert JavaScript in Custom Tag ...

Insert JavaScript in Custom Tag file.Tpl "is it possible"

Insert JavaScript in Custom Tag file.Tpl "is it possible"

Friday 06 July 2012 4:03:38 pm - 1 reply

Hello Everyone; 

I have some links in my website which should be displayed just for the visitors with PC.*

I have tried to do it with creating a cutom tag which contain a div or span and insert a JS code on onLoad,  but it doesnt work .

Has anyone know the where the problem is come from?

I have cerated a custom Tag in my content.ini  


Then in my file .tpl i have inserted a part of my javascript code:

<span id="testVisibility" onLoad="customizeForDevice();">{$content}</span>



       var customizeForDevice = function(){

              var ua = navigator.userAgent;

              var checker = {

                iphone: ua.match(/(iPhone|iPod|iPad)/),

                blackberry: ua.match(/BlackBerry/),

                android: ua.match(/Android/)


               function visiblityTest(){

                     if (checker.iphone){

                            window.document.getElementById("testVisibility"blunk.gif Emoticon.style.display = "none";


                     else {

                            document.getElementById("testVisibility"blunk.gif Emoticon.style.display = "{$display}";








Modified on Friday 06 July 2012 4:51:51 pm by ray lab

Friday 06 July 2012 5:38:13 pm

I found out the problem was with my js code , I have modify it and now it works .


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from