Ashok Goli
Ashok Goli

Reputation: 5183

Check Liferay Version from Browser

Is there a way to find out which version of Liferay is deployed on the Server from the Browser through Javascript/jQuery or the Source Code?

I have looked at Liferay's Javascript API. It consists of many helpful methods.

Liferay Javascript API Liferay Javascript API Liferay Javascript API

Is there a method in the API that I can use to find out which Liferay Version the loaded page is running on?

Edit: Or is there any other way like checking a loaded resource (js/images/css/source/theme) name from the client-end to confirm that the portal runs on a specific liferay version? Any crude suggestions are welcome.

Upvotes: 1

Views: 3829

Answers (2)

mud1e
mud1e

Reputation: 109

Inspecting the Response Headers with a modern browser you may see a header like:

Liferay-Portal : Liferay DXP Digital Enterprise…/ Build 7010 / June 15, 2016)

Hope its useful

Upvotes: 4

Alain Dresse
Alain Dresse

Reputation: 673

A couple crude suggestions:

  1. you could check the server administration page in the control panel.

  2. digging into the source for that page, I found that the static Java class com.liferay.portal.kernel.util.ReleaseInfo has all the information regarding the liferay version.

To my knowledge, this information is not readily accessible on publicly available client side, but you can make it so, for instance by inserting the following in your JSP :

  <aui:script>
      Liferay.version = "<%=HtmlUtil.escapeJS(com.liferay.portal.kernel.util.ReleaseInfo.getReleaseInfo()) %>"
  </aui:script>

EDIT: Liferay does include the build number in its static resource urls as the parameter b. for instance, in the following extract from the liferay.com home page :

<link href="[...]/main.css?[...]b=6120&amp;t=1382040996000" rel="stylesheet" type="text/css" />

the parameter b=6120 gives the build number of the portal. It is set in PortalImpl.java:

@Override
public String getStaticResourceURL(
    HttpServletRequest request, String uri, String queryString,
    long timestamp) {

      [...]

    // Build number

    sb.append("&b=");
    sb.append(ReleaseInfo.getBuildNumber());

      [...]

Hope this helps,

Alain

Upvotes: 7

Related Questions