diff --git a/assets/js/paybutton-paywall-cashtab-login.js b/assets/js/paybutton-paywall-cashtab-login.js index 1dbd905..eaba041 100644 --- a/assets/js/paybutton-paywall-cashtab-login.js +++ b/assets/js/paybutton-paywall-cashtab-login.js @@ -15,6 +15,10 @@ function handleLogin(address) { address: address }, function() { + var baseUrl = location.href.split('?')[0]; + // Build a new URL that includes a timestamp parameter to bust caches + var newUrl = baseUrl + '?t=' + Date.now(); + window.history.replaceState(null, '', newUrl); location.reload(); } ); diff --git a/assets/js/paywalled-content.js b/assets/js/paywalled-content.js index 1630d25..93adf1d 100644 --- a/assets/js/paywalled-content.js +++ b/assets/js/paywalled-content.js @@ -48,9 +48,11 @@ jQuery(document).ready(function($) { }, success: function() { setTimeout(function() { - // Build the new URL with the hash - var newUrl = location.href.split('#')[0] + '#unlocked'; - // Replace the current URL in the address bar without triggering a navigation + // Get the base URL (without any query parameters or hash) + var baseUrl = location.href.split('#')[0].split('?')[0]; + // Build a new URL that includes a timestamp parameter to bust caches + var newUrl = baseUrl + '?t=' + Date.now() + '#unlocked'; + // Update the URL in the address bar without triggering a navigation window.history.replaceState(null, '', newUrl); // Force a reload location.reload(); diff --git a/paybutton.php b/paybutton.php index 31c9107..96175e0 100644 --- a/paybutton.php +++ b/paybutton.php @@ -63,4 +63,4 @@ // Initialize AJAX handlers. new PayButton_AJAX(); -} ); +}, 1); // Use a priority to ensure this runs before other actions that might depend on session data. \ No newline at end of file