Hello,

I put some custom javascript blow of coorperation theme, when I logout from a userview and try to login, I find the javascript  will run towice,

for example, the javascript is like below,

$(document).ready(function(){
     console.log("abc"); }
);

it will show me towice in console.

Would you please help me to solve this issue?

Thanks

Gene

  • No labels

3 Comments

  1. Hi Gene,

    Unfortunately I don't have a real solution, however in the event you cannot find a proper clean solution, you could easily ensure the code only executes once using standard Javascript.

    var hasExecuted;
    
    $(document).ready(function(){
        if (hasExecuted) return;
    
        hasExecuted = true;
    
        console.log("abc"); }
    );

    Obviously this is a little hackish and not ideal, but if you have no other solution, this should work.

    Cheers,

    Troy

    1. Dear Troy,

      Thanks you very much!

      I still want to say it's a little bit stranger for me, as why the js script written in the "custom javascript" of corporationtheme diplayed twoice as the picture showed below in the login page. I don't know it's my fault or it's the theme bug, actually, I only put js code in one place - the "custom javascript"  of corporation theme. Maybe you can give me some advice.

      Thanks

      Gene

  2. I'm new to Joget too, and having a few problems of my own :P
    Just helping out where I can though.

    I haven't written any theme plugins, so I don't know the root-cause of the problem. Just a hacky solution to get around it in the mean time.

    It is hard to find good documentation, so if it isn't immediately obvious, I would call it a bug.

    Maybe someone more knowledgeable with Joget could provide some insight. If you do find the answer though you should update their documentation! At least that way nobody else will have to deal with the same thing.