Skip to content

Instantly share code, notes, and snippets.

@edwardkenfox
Created December 21, 2016 07:19
Show Gist options
  • Save edwardkenfox/257709d51e1b4e4bcce8f60f9e0307f7 to your computer and use it in GitHub Desktop.
Save edwardkenfox/257709d51e1b4e4bcce8f60f9e0307f7 to your computer and use it in GitHub Desktop.
20161221_s3_cors_test.html
<!doctype html>
<html class="no-js" lang="">
<head>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<div id="app">
<button @click="getAndExecuteFile">Get {{filename}}</button>
<br>
<span> {{image}} </span>
</div>
</body>
<script type="text/javascript">
window.vm = new Vue({
el: "#app",
data: {
filename: "https://s3-ap-northeast-1.amazonaws.com/edwardkenfox-tmp/alert.js",
image: null
},
methods: {
getAndExecuteFile: function() {
axios.get(this.filename)
.then((response) => {
this.image = response.data;
})
.catch((error) => {
console.warn(error);
});
}
}
})
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment