Use Javascript with Client Extension on pages
Written By
Madhusudan Sharma
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- How to run Javascript on pages using a client extension?
Resolution
With a JavaScript (JS) client extension you can run your own JavaScript on any page in Liferay without worrying about dependencies on Liferay code or developing a theme. Following are the steps that might help you here:
1. Navigate to Applications > Client Extensions.
2. Click on the '+' icon, and add JS.
3. Give it a name, add a URL of the JS file, and publish.
4. Now, navigate to Site Menu > Site Builder > Pages > Create a 'Widget Page'.
5. Check for the Advanced tab and under 'JavaScript Client Extension' click on 'Add Javascript Client Extensions'.
6. Choose the respective Javascript Client Extension and verify if it is implemented or not using Browser Console.
Did this article resolve your issue ?