Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Update JSONP docs to mention protection against hijacking#421

Merged
gjtorikian merged 1 commit intomasterfromupdate-jsonp-response
Feb 1, 2014
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletionscontent/v3.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -517,7 +517,7 @@ plus the relevant HTTP Header information.
<pre class="terminal">
$ curl https://api.github.com?callback=foo

foo({
/**/foo({
"meta": {
"status": 200,
"X-RateLimit-Limit": "5000",
Expand All@@ -533,14 +533,30 @@ foo({
})
</pre>

You can write a JavaScript handler to process the callback like this:
You can write a JavaScript handler to process the callback. Here's a minimal example you can try out:

<pre><code class="language-javascript">function foo(response) {
<pre><code class="language-html">&lt;html>
&lt;head>
&lt;script type="text/javascript">
function foo(response) {
var meta = response.meta
var data = response.data
console.log(meta)
console.log(data)
}</code></pre>
}

var script = document.createElement('script');
script.src = 'https://api.github.com?callback=foo'

document.getElementsByTagName('head')[0].appendChild(script);
&lt;/script>
&lt;/head>

&lt;body>
&lt;p>Open up your browser's console.&lt;/p>
&lt;/body>

&lt;/html></code></pre>

All of the headers are the same String value as the HTTP Headers with one
notable exception: Link. Link headers are pre-parsed for you and come
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp