"walle": "This image is not available to download as wallpaper.",
"walls": "Download this image. Use of this image is restricted to wallpaper only."
}
}
CORS Header
I discovered that it didn’t work directly by Ajax request because Microsoft doesn’t have add CORS Header :-/
JSONP Proxy service
So we needing a solution for resolve the Cross-Origin Request Blocked on my browser
1
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
The solution for retrieve the expected json is use a public JSONP Proxy service like yql (provide by Yahoo).
Code sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
var url = '//query.yahooapis.com/v1/public/yql' +
'?q=' + encodeURIComponent('select * from json where url=@url') +