How to Create a Pop-up Window for Your Website

May 11th, 2012

How to make a popup windowAt last you can create a pop-up window for your website! Whether a law imposes it or just for your own requirements, there are times when it’s necessary to filter Internet users who visit your site. Many users have asked us how to add a pop-up window. We’ll explain the process.

How to Create a Pop-up Window

With Webnode, the steps are the same as adding a widget with an embed code (HTML).

The code required to run the tool is as follows (all characters and symbols are to be copied as they are here. The code will not work if you change anything!)

<script type="text/javascript">
<!--
var answer = confirm("WRITE THE MESSAGE OF THE WINDOW HERE");
if (!answer){
window.location = "WRITE THE ALTERNATIVE WEB ADDRESS HERE";
}
//-->
</script>

Add a pop-up window to your website

Once you have copied the code, only replace the phrase in quotes that you want displayed, and enter the URL of the site where the visitor (who does not meet your requirements) will be redirected. Be sure to keep the quotes for both the message and the web address.

Publish and It’s Ready!

As soon as you publish the changes, the pop-up window starts showing. Remember, you can create pop-ups on any of your pages or subpages. However, note that this type of automated messages can discourage visitors. So we recommend its use only for cases where it is really necessary.

Do you want to build your own website using a website builder? Try the step-by-step guide.

Do you use pop-ups on your website?