Disabling SPA

Certain elements of your page may require a regular navigation to work properly. For example, you may have downloadable content that you want to share with the user. In these cases, SPA must be disabled for those specific elements. You can disable SPA at these scopes:

  • disable SPA across an entire Liferay DXP instance
  • disable SPA in a portlet
  • Disable SPA in individual elements

Follow the steps in the corresponding section to disable SPA for that scope.

Disabling SPA across an Instance

To disable SPA across an entire Liferay DXP instance, add the following line to your portal-ext.properties:

javascript.single.page.application.enabled = false

Disabling SPA for a Portlet

To disable SPA for a portlet, you must blacklist it. To blacklist a portlet from SPA, follow these steps:

  1. Open your portlet class.

  2. Set the com.liferay.portlet.single-page-application property to false:

    com.liferay.portlet.single-page-application=false
    

    If you prefer, you can set this property to false in your portlet.xml instead by adding the following property to the <portlet> section:

    <single-page-application>false</single-page-application>
    
  3. Alternatively, you can override the isSinglePageApplication method of the portlet to return false.

Disabling SPA for an Individual Element

To disable SPA for a form or link follow these steps:

  1. Add the data-senna-off attribute to the element.

  2. Set the value to true. See the example below:

    <a data-senna-off="true" href="/pages/page2.html">Page 2</a>
    

Nice! Now you know how to disable SPA in your app.

« Configuring SPA System SettingsSpecifying How Resources Are Loaded During Navigation »
Was this article helpful?
0 out of 0 found this helpful