Forum Documentation Showcase Pricing Learn more

Amazon JS Error


#1

Just wondered if anyone knew how I could possibly fix this error seen in the Console when trying to use the Amazon Widgets?

The connection used to load resources from https://wms-eu.amazon-adsystem.com used TLS 1.0 or TLS 1.1, which are deprecated and will be disabled in the future. Once disabled, users will be prevented from loading these resources. The server should enable TLS 1.2 or later. See https://www.chromestatus.com/feature/5654791610957824 for more information.

I’m attempting to add the Amazon Widget JS code into an HTML element and it looks like this…

<script type='text/javascript' src='https://wms-eu.amazon-adsystem.com/20070822/GB/js/AmazonWidgets.js'>
</script>

<script type='text/javascript'>
var amzn_wdgt={widget:'MyFavorites'};
amzn_wdgt.tag='swaplot1977-21';
amzn_wdgt.columns='1';
amzn_wdgt.rows='1';
amzn_wdgt.title='Henri-Cartier-Bresson: Photographer Extraordinaire';
amzn_wdgt.width='168';
amzn_wdgt.ASIN='0893817449';
amzn_wdgt.showImage='True';
amzn_wdgt.showPrice='True';
amzn_wdgt.showRating='False';
amzn_wdgt.design='1';
amzn_wdgt.colorTheme='White';
amzn_wdgt.headerTextColor='#39C5DB';
amzn_wdgt.marketPlace='GB';
</script>

But all the browsers are complaining about the prevention of mixed content and I have no idea how to resolve it. If I change the protocol from https to http (for the AmazonWidgets.js script) then the error changes and becomes:

Mixed Content: The page at ‘https://swaplot.co.uk/version-test’ was loaded over HTTPS, but requested an insecure script ‘http://wms-eu.amazon-adsystem.com/20070822/GB/js/AmazonWidgets.js’. This request has been blocked; the content must be served over HTTPS.

So how do we make it work? any ideas?

Thanks
Paul


#2

Well, looks like I fixed my own problem, so hope this helps someone.

I put this in the Header script


<script src="https://cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.8/postscribe.min.js"></script>

And then I changed the HTML from what I previously had, to the following

<div id="ad"></div>

<script type="text/javascript">
  $(function() {
    postscribe('#ad', '<script src=https://wms-eu.amazon-adsystem.com/20070822/GB/js/AmazonWidgets.js><\/script>');
  });
</script>

<script type='text/javascript'>
var amzn_wdgt={widget:'MyFavorites'};
amzn_wdgt.tag='swaplot1977-21';
amzn_wdgt.columns='1';
amzn_wdgt.rows='1';
amzn_wdgt.title='Henri-Cartier-Bresson: Photographer Extraordinaire';
amzn_wdgt.width='168';
amzn_wdgt.ASIN='0893817449';
amzn_wdgt.showImage='True';
amzn_wdgt.showPrice='True';
amzn_wdgt.showRating='False';
amzn_wdgt.design='1';
amzn_wdgt.colorTheme='White';
amzn_wdgt.headerTextColor='#39C5DB';
amzn_wdgt.marketPlace='GB';
</script>

Regards,
Paul