Diffy documentation
CtrlK
  • Features
    • 👋Welcome
    • Mask & Exclude
    • JavaScript snippets
    • HTTP headers
    • Cookies
    • CSS overrides
    • Mock content
    • Dealing with Dynamic Elements
      • Freeze Carousels / Sliders
      • Cookies Policy Popups
      • Misc javascript snippets
    • Configure project from YAML file
    • Zapier integration (JIRA, Trello, Basecamp integrations)
    • Bypass protection Cloudfront, Akamai, Incapsula
      • Bypass Akamai protection
      • Bypass Imperva Incapsula protection
    • Tags
    • Figma
    • Local development
      • DDEV add-on
      • Lando integration
      • Docksal
      • Standalone docker container
      • Ngrok
  • Automation
    • 💡Overview
    • GitHub Pantheon CircleCI
    • GitHub Pantheon GitHub Actions
    • GitHub Tugboat
    • Platformsh GitHub Action
  • Tutorials
    • Comparison review
Powered by GitBook
On this page
  1. Features
  2. Dealing with Dynamic Elements

Misc javascript snippets

WP Engine replaces the link text automatically for staging environments. To avoid false positives that we can apply JavaScript:

const allLinks = document.querySelectorAll('a');
allLinks.forEach(link => {
  let linkText = link.textContent;
  if (linkText.indexOf("abc.wpenginepowered.com") !== -1) {
    link.textContent = linkText.replace("abc.wpenginepowered.com", "abc.com");
  }
});
PreviousCookies Policy PopupsNextConfigure project from YAML file

Last updated 20 days ago