4

I seem to be having trouble getting the Mailchimp pop-up subscribe function to work on Chrome:

I added the following code to my index.html page in django:

<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false">
</script>
<script type="text/javascript">window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us19.list-manage.com","uuid":"4eccd5a19349953c3e023b61d","lid":"9b2e4611ac","uniqueMethods":true}) })
</script>

Seems to be working fine in Opera, Firefox and IE but in Chrome I get the following error:

Uncaught TypeError: window.dojoRequire is not a function.

What am I missing to make this work in Chrome?

Additional info:

  • Python 3.6.1
  • Django 2.1.3
Ken
  • 344
  • 4
  • 12

3 Answers3

2

I just had the same issue and I figured out what went wrong: ad blockers.

Ad blockers prevent MailChimp popup signup form from showing up on your website. More precisely, an ad blocker prevents the Mailchimp JS script from loading which causes the Uncaught TypeError: window.dojoRequire is not a function error.

Bottom line: if a user is not using an ad blocker, the popup form would show up just fine. But if you want to make sure ALL users see the popup, create your own custom popup instead (using Bootstrap Modal, for example) and sign a user to MailChimp via the MailChimp API.

ramuta
  • 260
  • 2
  • 11
1

You'll have to wait for the first script to download and run, which creates the dojoRequire function. The second script is using the function before it has been created by the first. You can use a setTimeout() = yuck, or look for ways on stackoverflow to wait for the page to load, such as Wait until Javascript files are loaded

bjjer
  • 43
  • 1
  • 7
0

My issue was the "DuckDuckGo Privacy Essentials" firefox extension was blocking it, not my ad blocker.

Shane
  • 659
  • 1
  • 9
  • 19