Preview Monitor Issue - Object.init_consentStatus
What is the Problem?
Following the recent update 4.1.7, there's a potential issue in the preview process that warrants attention. Refer to the attached screenshot, which outlines the problem evident in the browser's console output:
“Cannot read properties of undefined …”
“Object.init_consentStatus”
Upon the initial deployment, opening a preview functions smoothly. However, closing the tab and reopening a preview session later, or clearing session storage, can result in a javascript disruption during the subsequent session. This stems from the new local storage format (due to the new Feature “Maximum Storage Lifetime”), incompatible with the previous version's handling.
What is the Solution?
To address this and ensure a seamless experience, consider the following resolutions:
Resolution 1: Publish Current Version to Live Publishing your current version to the live environment will definitively resolve this issue. Doing so will incorporate the updated local storage format, ensuring compatibility.
Resolution 2: Temporary Console Fix If live publishing isn't currently feasible, a temporary fix can be applied using the console. After encountering the error indicated in the screenshot, execute these two lines of code in the console:
window.localStorage.clear();
window.location.reload();
This action clears local storage and refreshes the page, temporarily restoring proper functionality for the ongoing preview session.
Summary:
The recent update brings to light a possible issue during the preview process. This anomaly stems from incompatible local storage formats (due to the new Feature “Maximum Storage Lifetime”), causing javascript disruptions in subsequent sessions. To rectify this, choose between publishing the current version to the live environment for permanent resolution, or utilizing a temporary console fix to address it during the preview session. These measures ensure the benefits of customizable expiration dates for cookies and local storage while minimizing any inconveniences.