Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jasondavis/b43267960970404c54479ac66965a875 to your computer and use it in GitHub Desktop.
Save jasondavis/b43267960970404c54479ac66965a875 to your computer and use it in GitHub Desktop.
allOrigins - Pull contents from any page via API (as JSON/P or raw) and avoid Same-origin policy problems.

allOrigins - Pull contents from any page via API (as JSON/P or raw) and avoid Same-origin policy problems.

A Pen by Jason Davis on CodePen.

License.

allOrigins

Pull contents from any page via API (as JSON/P or raw) and avoid Same-origin policy problems.

<textarea id="html">frf</textarea>
$.getJSON(
"https://api.allorigins.win/get?url=" +
encodeURIComponent("https://wikipedia.org"),
function (data) {
//alert(data.contents);
$("#html").val(data.contents);
}
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment