2

Using the jQuery.ajax() function it is possible to cache a JSONP response by utilizing its cache & isModified properties.

The WinJS.xhr function doesn't appear to have any direct properties. I've seen a lot of questions asking for a way to DISABLE caching. I need a way for a JSONP response to be always cached.

I've tried something like this but it doesn't work -

WinJS.xhr({ 
    url: URL_that_returns_JSONP_response,
    headers: {
        "Cache-control": "Public"
    } })
    .done(
...

When I check the HTTP response status with Fiddler, I see that the status code is still 200 & the response is not cached. How can I enable caching of JSONP response while using WinJS.xhr?

1
  • You realize that you can use jquery in WinJS projects just fine? Nov 13, 2012 at 21:00

1 Answer 1

0

Becuse a JSONP request works by creating a <script> element with its src attribute set to the request URL. You cannot add custom headers to the HTTP request sent by a <script> element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.