Introduction
This article explains how to switch from a Responsive Web Offline navigation profile to Responsive Web (online) profile in a Mendix application. This workaround enables navigation from an offline profile to an online profile without experiencing profile interference or cached resource conflicts.
Environment
Studio Pro (all versions)
Instructions/Procedure
Implement a nanoflow with a custom JavaScript action to clear the session and redirect to the target profile:
- Create a new nanoflow in Studio Pro (for example,
ACT_SwitchToResponsive). - Add a Get Remote URL action to retrieve the target URL for the Responsive profile.
- Add a Create Variable action and name it RedirectURL to store the retrieved URL.
- Create a new JavaScript action named
JS_GoToResponsivewith the following configuration:- Add a parameter url of type String
-
Add the following code to the action:
import "mx-global"; import { Big } from "big.js"; /** * @param {string} url * @returns {Promise.<void>} */ export async function JS_GoToResponsive(url) { localStorage.clear("session"); window.open(url, "_blank"); return; }
-
Add the
JS_GoToResponsiveJavaScript action to the nanoflow and pass the RedirectURL variable as the parameter. - Configure a button, menu item, or navigation element to trigger the nanoflow.
- Test the implementation by navigating from the Responsive Offline profile to the Responsive profile.
Outcome
The application clears the session data and opens the Responsive (online) profile in a new browser tab, preventing interference between the offline and online profiles.
Internal information related
277583
Additional information
Mendix documentation: Navigation Profiles
0 Comments