2

I'm trying to implement a mailchimp pop up my page but it doesn't work. To be sure that it's not due to a js conflict I tried the JS code they provide on a simple html page.

<!DOCTYPE html>
<html lang='en'>
<head>
  <meta charset="utf-8">
  <title>testpop</title>
</head>
<body>

  <style>
    html {
      background: #3a1c71;
      font-family: 'helvetica neue';
      text-align: center;
      font-size: 10px;
    }
  </style>
<!-- Here is the mailchimp js  -->
<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"//mc.us17.list-manage.com","uuid":"af12c8121a0cbbd603454ea9e","lid":"4904281888"}) })</script>
</body>
</html>

I got then the following message :

GET file://downloads.mailchimp.com/js/signup-forms/popup/embed.js net::ERR_FILE_NOT_FOUND testmail.html:18 Uncaught ReferenceError: require is not defined

I though that maybe the source shouldn't start with '//....' but like that 'http://...'

I don't see any error in my console now but there is no pop up either

Doge
  • 93
  • 3
  • 11

2 Answers2

1

The Uncaught Reference Error is not due to the popup cookies.

Your problem was that you were probably trying to test this in a local folder, without running a server, therefore the GET error. Also, changing it to http:// instead of // doesn't solve the problem since you will have errors with other evil popup content. See this question for an example of the same problem: Script tag is loading from file:/// instead of http://

Just get this running in your localhost or on a remote server and you will not get this error again.

I had to go through this myself and I thought it could be useful to other newbies.

0

I found the solution. My issue was that Mailchimp uses cookies to prevent popup to show up each time a user open the page.

To overcome this setting, I had to work on two cookies 'MCPopupClosed'and 'MCPopupSubscribed'

document.cookie = "MCPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
document.cookie = "MCPopupSubscribed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";

for more information, check this question : Launch Mailchimp evil popup onclick . I hope it will help

Doge
  • 93
  • 3
  • 11