Reputation: 3940
It looks like AJAX is indeed unable (at least for all practical purposes) to write foreign HTML to the current page. But what if your CDN website had, say, a JS that would simply document.write()
everything? Then your HTML document would have nothing but a remote script.
<html>
<script src="https://pastebin.com/raw.php?i=0wm5v7i6">
</script>
</html>
I tried this. Funny thing is, sometimes it works and other times it does a kind of security error:
Why doesn't this work? What if, on your own website, you simply put everything on an easy host like Google Drive?
Upvotes: 1
Views: 233
Reputation: 101700
From the looks of it, PasteBin doesn't supply content over SSL (https). You've put https
in the URL to your script, but PasteBin just redirects this request to http
, and the net effect is that you are trying to access a script over http
when the page is accessed over https
, and Chrome prevents that.
Just try going to https://pastebin.com/raw.php?i=0wm5v7i6
: your browser will be redirected to http://pastebin.com/raw.php?i=0wm5v7i6
.
Upvotes: 0
Reputation: 123380
What if, on your own website, you simply put everything on an easy host like Google Drive?
That is possible, unless
Upvotes: 2