Mailchimp - Filenotfound

Mailchimp - Filenotfound

我正在尝试实现一个 mailchimp 弹出我的页面,但它不起作用。为了确保这不是由于 js 冲突,我尝试了他们在一个简单的 html 页面上提供的 JS 代码。

<!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>

然后我收到以下消息:

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

我想也许来源不应该以 '//....' 但像那样 'http://...'

我现在在我的控制台中没有看到任何错误,但也没有弹出窗口

我找到了解决方案。 我的问题是 Mailchimp 使用 cookie 来防止每次用户打开页面时弹出窗口出现。

为了克服这个设置,我不得不处理两个 cookie 'MCPopupClosed' 和 '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=/";

有关更多信息,请查看此问题:Launch Mailchimp evil popup onclick。 希望对你有帮助

未捕获的引用错误不是由于弹出 cookie 造成的。

您的问题是您可能试图在没有 运行 服务器的本地文件夹中测试它,因此出现 GET 错误。 此外,将其更改为 http:// 而不是 // 并不能解决问题,因为您会遇到其他恶意弹出内容的错误。有关同一问题的示例,请参阅此问题:

只需在您的本地主机或远程服务器上获取此 运行,您就不会再遇到此错误

我必须自己完成这个,我认为它可能对其他新手有用。