Fix history.replaceState() error when accessing Mendix app from iOS device - Mendix Forum

Fix history.replaceState() error when accessing Mendix app from iOS device

1

Having spent some hours trying to solve a bug I encountered today, I realized that the bug inherently occurs from Mendix's Page URL property.

When setting the URL property of a page, you cannot use that page in a Mobile Mendix app, such as from the Mendix App.
Trying to do so results in the following error:

Client: Blocked attempt to use history.replaceState() to change session history URL from file:///var/mobile/Containers/Data/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Library/NoCloud/www/index.html to file:///mobile/Containers/Data/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Library/NoCloud/www/storage/resources/p/. Paths and fragments must match for a sandboxed document. replaceState@[native code]

history.replaceState() is a JavaScript function that substitutes the shown URL of a webpage, without causing the browser to redirect/reload the page.

As to why I am using a page which has its URL property set when running my Mendix App on a mobile device is because I am trying to use the responsive layout features of Mendix/Bootstrap to avoid having to design and maintain twice the amount of pages, microflows and other resources in my Mendix App.


My suggestion here is to fix Mendix so that accessing a page on a Mendix app with its URL property set will ignore using history.replaceState().

asked
0 answers