We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Referer header is preserved when a GM_xmlhttpRequest request is redirected
The Referer header is not preserved when a GM_xmlhttpRequest request is redirected.
// ==UserScript== // @name referer header issue // @version 1.0 // @description try to take over the world! // @author Me // @include * // @grant GM_xmlhttpRequest // ==/UserScript== const fetch = (url, options) => { return new Promise((resolve, reject) => { GM_xmlhttpRequest({ method: 'GET', url, responseType: 'json', ...options, onload: (res) => { const { statusText, status, response } = res; if (status !== 200) { reject(new Error(statusText || `${status}`)); } else { resolve(response); } }, ontimeout: () => { reject(new Error('timeout')); }, onerror: (error) => { reject(error); }, }); }); }; const url = 'https://m.douban.com/rexxar/api/v2/movie/36205404/?for_mobile=1'; const options = { headers: { Referer: 'https://m.douban.com/movie/subject/36205404', }, }; fetch(url, options).then((res) => { console.log(res); }).catch((error) => { console.error(error); });
The text was updated successfully, but these errors were encountered:
At the moment I think that this is a Chrome bug. Will add a workaround though.
Sorry, something went wrong.
Should be fixed at 5.3.6212 (crx|xpi in review)
Please download the crx file linked above and drag and drop it to the extensions page chrome://extensions (after you've enabled 'Developer Mode').
chrome://extensions
For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.
GM_xmlhttpRequest
No branches or pull requests
Expected Behavior
Referer header is preserved when a GM_xmlhttpRequest request is redirected
Actual Behavior
The Referer header is not preserved when a GM_xmlhttpRequest request is redirected.
Specifications
Script
The text was updated successfully, but these errors were encountered: