Providing Cross Domain access to images and data in Codepen

GeoJSON data as a Codepen
Enabling CORS in AWS
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Make an image public in S3
var loadGrid = function(){
gridImg = new Image();
gridImg.src = "https://s3.amazonaws.com/codepen-mh/collage/environment/perspective-grid.png";
$(gridImg).load(function(){
drawGrid();
});
}
gridImg.crossOrigin = "Anonymous";

--

--

--

Freelance Creative Coder

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

2020’s steps to build a modern front-end environment

Contentful’s Great Save of Great Gatsby.js

Why You Should Learn the Basics Before Becoming a Vue.js or React Developer

Goodbye Electron, Hello Desktop PWAs

Code Dump: Heap’s Algorithm (Permutations)

A Quick Guide to React Hook — useState

[LeetCode — 322] Coin Change

React Redux

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mike Heavers

Mike Heavers

Freelance Creative Coder

More from Medium

Two ways to connect with AWS IoT core

Proxy Server Errors: the Main Types and Ways to Fix Them

How to create Twilio call and message feature in Nodejs?

The Heroku Procfile