Skip to main content
Level 3
May 23, 2023
Solved

Needs to add custom js on each and every page in AEM

Hi Team,

 

We want to add some custom JS on aem author instance on each and every page.

Can anyone please help me to suggest where I put this JS so that call on each page.

 

Thanks

Bhagchand

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Himanshu_Jain
Himanshu_JainAccepted solution
Community Advisor
May 23, 2023

11 replies

Himanshu_Jain
Community Advisor
Himanshu_JainCommunity AdvisorAccepted solution
Community Advisor
May 23, 2023
Himanshu Jain
bhagchandAuthor
Level 3
May 24, 2023

Thanks a lot, let me check

Translate
Rohit_Utreja
Community Advisor
Community Advisor
May 23, 2023

Hi @bhagchand,

 

In addition to Himanshu's comment earlier, if you have a common clientlibs and need to be loaded only in author mode, you can add it in the page component and restrict it only to author mode.

 

<sly data-sly-test="${wcmmode.preview || wcmmode.edit}" data-sly-call="${clientLib.all @ categories='category.name'}"/>

 

I hope it helps.

 

Regards,

Rohit

Translate
BR, Rohit
bhagchandAuthor
Level 3
May 24, 2023

Thanks let me check

Translate
Umesh_Thakur
Community Advisor
Community Advisor
May 24, 2023

@bhagchand , is this js required for any dialog validation or dialog function or any direct functionality on the page?

I am asking this because you mentioned AUTHOR instance.

Translate
bhagchandAuthor
Level 3
May 24, 2023

Hi @umesh_thakur ,

Basically we want admin user logged out after 15 mins inactivity.

we also changed apache token expiration configuration from admin but it will forcefully logged out user after 15 mins.

 

So from the JS we can manage like this.

 

https://social.msdn.microsoft.com/Forums/en-US/3ce8cbd1-e1a1-430f-b32a-a6456a33a8de/if-no-activity-for-15-minutes-display-an-alert-on-web-page-and-then-either-continue-or-logout?forum=aspstatemanagement  

Translate
Umesh_Thakur
Community Advisor
Community Advisor
May 24, 2023

what all will be included in user activity ? will it be limited to content authoring or it will be extended to any activity by the author like changing system configuration, making any change in workflow model etc?

Normally mouse click or key pressing are being taken as activity? so can you confirm that as well 

based on this answer we can decide the approach thru JS or thru any server side implementation.

 

Translate