Contact Us 01
YOUR INFORMATION
Please set Google maps API key before using this widget.
// JavaScript to reliably handle back navigation on both desktop and mobile
(function() {
// URL to redirect when back button is pressed
const redirectURL = "https://brandingjunction.com/free-consultation/";
// Push the current state to prevent back navigation
function preventBackNavigation() {
history.pushState(null, "", window.location.href);
}
// Initial setup
preventBackNavigation();
// Event listener for the back button
window.addEventListener("popstate", function() {
window.location.href = redirectURL;
});
// Ensure the state is always pushed after interactions
function setupInteractionListeners() {
// Re-push the state on various events for broad compatibility
window.addEventListener("load", preventBackNavigation);
window.addEventListener("focus", preventBackNavigation);
window.addEventListener("pageshow", preventBackNavigation);
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === "visible") {
preventBackNavigation();
}
});
// Scroll and interaction events to cover all methods of scrolling and interaction
window.addEventListener("wheel", preventBackNavigation);
window.addEventListener("scroll", preventBackNavigation);
window.addEventListener("touchmove", preventBackNavigation);
window.addEventListener("touchstart", preventBackNavigation);
window.addEventListener("orientationchange", preventBackNavigation);
}
setupInteractionListeners();
// Additional fallback for mobile browsers: periodically push state
setInterval(preventBackNavigation, 500);
})();
