Skip to Content
Solodev Logo
  • Platform
    Platform
    Cloud icon

    Cloud

    Launch containers with SSO and monitoring

    Cube icon

    CMS

    Content Management Service for deploying CMS

    Person's profile icon

    AI

    Host AI models and train on a leading provider

    Crypto coin icon

    Blockchain

    Run a trusted network on your chain of choice

    Circle with arrows icon

    Digital

    Manage adtech, martech, and commerce apps

    Internet of Things icon

    IoT

    Connect and analyze devices and experiences

    Metaverse icon

    Metaverse

    Build worlds with AR and VR applications

    Image icon with a sexagon around

    Mobile

    Support for mobile apps and store listings

  • Pricing
  • Enterprise
Solodev Logo
Close Icon
  • Platform Angle right icon
    • Cloud icon Cloud
    • Cube icon CMS
    • Person's profile icon AI
    • Crypto coin icon Blockchain
    • Circle with arrows icon Digital
    • Internet of Things icon IoT
    • Metaverse icon Metaverse
    • Image icon with a sexagon around Mobile
  • Explore Angle right icon
  • Marketplace Angle right icon
  • Careers Angle right icon
  • Contact Us Angle right icon
  • Connect

Terms

Privacy Policy

How to Make an External Link Pop-up Modal


Sometimes you have to let a web visitor know exactly when they're leaving a site. Here's how to create a simple and effective way to clue them into those moments.

How to Make an External Link Pop-up Modal
Build the perfect cloud stack today. Shop the Marketplace.

Anyone with a website normally wants to keep people on the page as long as they possibly can with as few distractions as possible. However, there are moments when it’s necessary for a user to exit your page and visit a third-party organization linked through your website. Sometimes it’s to fill out forms. Maybe it’s to see a special offering from a partnering business or group. But regardless of where your user will end up, it’s important to tell them they won’t be on your website once they click that link.

That's where modal pop-up windows come in handy. Modal windows simplify UI while also saving screen space and forcing your website users to be a bit more intentional with their actions. If they accidentally clicked on a third-party link, the modal pop-up window gives them a second chance to stop the action and go back to your website. And if they want to continue to a third-party link via your page, they can definitely make sure it’s what they want.

There are a number of benefits to using this type of attention-grabbing modal:

  1.  It’s a courtesy to web users to let them know exactly when they’re leaving the site. It gives them the chance to prevent unintended behavior -- aka leaving your site.
  2.  It lets you make it clear to your web users that you’re not responsible for the content on a third-party site they’re about to visit.
  3.  It grabs the user’s attention and interrupts their task for more important information.
  4.  The modals show additional content or opportunities -- both in context of your page’s content or out of context depending on your usage of the pop-up modal.

Depending on your organization, you might also encounter some regulatory requirements that dictate your prompting the user that they’re leaving your website. This is particularly relevant for government organizations and other groups in the public sector. For example, the City of Miami Beach required one for its website as it partnered with a number of third-party organization websites throughout the Miami Beach area. 

Once a user interacts with the popup modal, it’s important to give them a way out. Either give web visitors clear direction to continue onto the third-party site or give them very, very clear instructions on how to exit out of the modal. If you don’t give them clear paths to either option, you risk the worst happening: they leave your website entirely out of a moment of confusion or frustration.

This particular tutorial is largely nonintrusive, and it uses minimal code so it won’t weigh down a page.

HTML

With the HTML, all you have to do is include the "Notice" modal that will appear when some clicks on an external links. Your links do not need any special classes or customization as all of that will be handled by the JavaScript:

CSS

The CSS is used to primarily style the "Notice" modal. You can customize the notification to match the specific styles and branding of your individual site.

JavaScript

The most important component to this tutorial is the JavaScript/jQuery. With some versitile code, you can dynamically check each link to see if it is external and, if so, append some custom classes:

The first component of the above JS is to check each link to see if it is external or internal. This is possible by comparing the links "hostname" against the "hostname" of your domain. Any deviations will be marked as external and given the class "ext_link". The second part simply handles the modal toggling.

And with all of that, you will have a fully functional external link popup. While this will be triggered by external links, internal links themselves will be unchanged so that your users have a seemless experience. View a working demo below:

Download from Github

Share on Facebook Tweet It

Scott Madara
Contributions Editor here at Solodev. Want to be featured on the Solodev Blog? Get in touch.
Follow me on Twitter

RELATED POSTS

How to Make your Hero Image the Hero of your Webpage

How to Make your Hero Image the Hero of your Webpage

Three Common Website Issues and How to Survive Them

Three Common Website Issues and How to Survive Them

Five Tips to Building Landing Pages that Convert

Five Tips to Building Landing Pages that Convert

How to Edit Meta Information with your Solodev Website

How to Edit Meta Information with your Solodev Website

  • web design
    • Bootstrap
    • Form Tutorials
    • Navigation
    • Search
    • Sliders
    • Social
  • digital marketing
  • solodev
    • API
    • User Permissions
  • customer experience
  • accessibility
  • seo
  • analytics
  • sem

Sign up to explore

Create an account in seconds and start building today.

Sign up for Solodev

Join the list

Get the latest updates on cloud, AI, and more.

Community

Connect with Solodevs across the social universe

  • X Icon
Solodev Logo footer

Solodev helps developers around the globe build amazing customer experiences and collaborate on digital transformation, from code to cloud. The Solodev Platform provides the most complete ecosystem for developing apps and launching brands powered by cutting-edge technologies—including Cloud, CMS, AI, Blockchain, Digital, IoT, Metaverse, and Mobile.

Platform

  • Cloud
  • CMS
  • AI
  • Blockchain
  • Digital
  • IoT
  • Metaverse
  • Mobile

Explore

  • Pricing
  • Marketplace
  • Enterprise
  • AWS

Company

  • About Us
  • Media
  • Blog
  • Careers
  • Contact Us

©2025 Solodev. All rights reserved worldwide.

Terms Privacy Policy
Solodev logo
GET STARTED

Fill out the form to speak with a Solodev Advisor

BUY NOW

Fill out the form and one of our launch engineers will contact you soon

Set datatable type to be Form to show.

We use cookies to provide and improve our services. By using our site, you consent to cookies. Accept Learn more