| 'use strict'; |
| |
| var ajax = require('./deps/ajax'); |
| |
| module.exports = function(opts, callback) { |
| |
| // cache-buster, specifically designed to work around IE's aggressive caching |
| // see http://www.dashbay.com/2011/05/internet-explorer-caches-ajax/ |
| // Also Safari caches POSTs, so we need to cache-bust those too. |
| if (process.browser && |
| (opts.method === 'POST' || opts.method === 'GET') && !opts.cache) { |
| var hasArgs = opts.url.indexOf('?') !== -1; |
| opts.url += (hasArgs ? '&' : '?') + '_nonce=' + Date.now(); |
| } |
| |
| return ajax(opts, callback); |
| }; |