Mailchimp has a handy feature where it can embed a list of clickable Mailchimp-hosted archives of your email newsletters. Unfortunately, if your site is served over https, then Mailchimp’s “Folder Archive Generator” Javascript code doesn’t work in modern browsers. This is because the JS tries to retrieve the archive over http which creates a mixed encrypted/non-encrypted content page on your site.
<script language="javascript" src="http://us9.campaign-archive2.com/generate-js/?u=abc123&fid=12345&show=10" type="text/javascript"></script>
And you can’t just change the URL from http://us9.campaign… to https://us9.campaign… because Mailchimp doesn’t have SSL certificates running on those domains.
A Solution
Mailchimp doesn’t have an alternative SSL-based server you can use, so you’ll have to either code against their API, or do a PHP hack like this:
$mailchimpArchives = file_get_contents('http://us9.campaign-archive2.com/generate-js/?u= abc123&fid=12345&show=10'); echo('<script language="javascript">' . $mailchimpArchives . '</script>');
Thanks for this post! Very helpful, as I was trying to figure out why the archive code wasn’t working with my site.
My web development skills are limited—do you have any examples of implementing an archive via the Mailchimp API?
Extremely helpful. Your solution worked great!
This looks like the solution to the issue I’m trying to solve! However, like James, who commented a few years ago, my development skills are somewhat limited…
If I wanted to implement the “PHP hack”, how would I go about it? Is the code sample placed in a .php file and then referenced somehow in my .htm code? Alternatively, could you offer an example of how to code against the MailChimp API?
Thanks for whatever more detailed help you can offer.
perfect!, thanks you very much!