Jump to content

JC84

Member
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

JC84's Achievements

  1. This code worked for me. Use #signout as your href: <script> document.addEventListener("DOMContentLoaded", function () { // Listen for clicks on elements with href="#signout" document.addEventListener("click", function (e) { const target = e.target; // Check if the clicked element is a link with href="#signout" if (target.tagName === "A" && target.getAttribute("href") === "#signout") { e.preventDefault(); // Prevent the default behavior of the link // Step 1: Open MY ACCOUNT const accountLink = document.querySelector(".user-accounts-text-link"); if (accountLink) { accountLink.click(); // Simulate a click to bring up MY ACCOUNT console.log("MY ACCOUNT opened via #signout."); // Step 2: Hide iframe immediately once it is added to the DOM const iframeObserver = new MutationObserver(function () { const iframe = document.querySelector("iframe#accountFrame"); // Get the iframe if (iframe) { iframe.style.visibility = "hidden"; // Hide iframe temporarily iframe.style.opacity = "0"; // Make iframe invisible console.log("Iframe is hidden."); iframeObserver.disconnect(); // Stop observing once iframe is found and hidden // Step 3: Navigate to Account Settings setTimeout(function () { if (iframe.contentDocument) { const accountSettingsLink = iframe.contentDocument.querySelector('a[href="/account"]'); if (accountSettingsLink) { accountSettingsLink.click(); // Simulate a click to navigate to Account Settings console.log("Navigated to Account Settings."); // Step 4: Click Sign Out setTimeout(function () { const signOutButton = iframe.contentDocument.querySelector( 'button[data-test="sign-out"]' ); if (signOutButton) { signOutButton.click(); // Simulate a click to sign out console.log("Sign out button clicked."); } }, 500); // Delay click for sign out } } }, 1000); // Wait 1 second for Account Settings link to load // Step 5: Unhide the iframe after all actions are completed setTimeout(function () { iframe.style.visibility = "visible"; iframe.style.opacity = "1"; // Restore iframe visibility after everything is done console.log("Iframe restored after sign out."); }, 2500); // After 2.5 seconds, restore iframe visibility } }); iframeObserver.observe(document.body, { childList: true, subtree: true }); } else { console.error("MY ACCOUNT link not found."); } } }); }); </script>
  2. Hey there! but what about if you're selling a digital product without a shipping address? Any ideas? Thanks, Josh
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.