How can I disable SennaJS/SPA in Liferay 7?
Asked Answered
P

1

8

Liferay 7 uses SennaJS as its Single Page Application engine in order to load and replace certain parts of the portal page during form submission and navigation. Occasionally this feature interferes with my use case, so how can I disable it?

Principal answered 22/12, 2016 at 16:48 Comment(0)
P
17

If you want to disable the XHR GET navigation performed by SennaJS or its handling of form submissions, you can try one of the following:

  • If you want to disable SPA for only certain forms or links, you can add the data-senna-off="true" attribute to those <form> or <a> tags.

  • If you want to disable SPA for only one portlet, you can add <single-page-application>false</single-page-application> to the <portlet> section of your liferay-portlet.xml (see the DTD for the expected order of liferay-portlet.xml elements).

  • If you want to disable SPA for only one OSGi module portlet, you can add "com.liferay.portlet.single-page-application=false" to your portlet metadata.

  • If you want to disable SPA on a portal wide basis, you can add javascript.single.page.application.enabled=false to your portal-ext.properties file.

Principal answered 22/12, 2016 at 16:48 Comment(3)
how about per site?Imogen
@Syd, I don't know if that's possible. You could always request that as a feature from Liferay Portal: issues.liferay.comPrincipal
Is there a way to disable the SPA only for pages that contain portlets marked with single-page-application? URLs generated within those portlets work correctly. Under a condition of full page reload but a navigation event form a journal article with url to the page containing such portlet is still produced with SPA engine resulting in uninitialized scripts on no SPA ready portlet.Baptistry

© 2022 - 2024 — McMap. All rights reserved.