Відгуки для Header Editor
Header Editor автор 泷涯, 道滿
Відгук від SkySkimmer
Оцінка 4 з 5
від SkySkimmer, 8 років томуthuerrsch said
>Here I set up a single, simple rule to "Modify the response header", match type "All", execute type "normal", to always set the "Content-Disposition" header type to a value of "inline". That's it, two minutes to set up the whole thing, and it works beautifully!
This is also what I wanted to use this extension for, but this simple solution will remove the filename information which may be passed in that header. Instead I used the following custom function which mostly works. Note that the "tobytes" call is necessary otherwise on unicode strings firefox complains about too-high charcodes.
function tobytes (str) {
let res = "";
for (let i = 0; i < str.length; ++i) {
let code = str.charCodeAt(i);
if (code > 255) {
res += encodeURI(str[i]);
}
else {
res += str[i];
}
}
return res;
}
for (let a in val) {
if (val[a].name.toLowerCase() === 'content-disposition') {
let orig = val[a].val
console.log("orig: " + val[a].value);
let res = val[a].value.replace(/^attachment/iu, "inline");
res = tobytes(res);
console.log("res: " + res);
val[a].value = res;
}
}
>Here I set up a single, simple rule to "Modify the response header", match type "All", execute type "normal", to always set the "Content-Disposition" header type to a value of "inline". That's it, two minutes to set up the whole thing, and it works beautifully!
This is also what I wanted to use this extension for, but this simple solution will remove the filename information which may be passed in that header. Instead I used the following custom function which mostly works. Note that the "tobytes" call is necessary otherwise on unicode strings firefox complains about too-high charcodes.
function tobytes (str) {
let res = "";
for (let i = 0; i < str.length; ++i) {
let code = str.charCodeAt(i);
if (code > 255) {
res += encodeURI(str[i]);
}
else {
res += str[i];
}
}
return res;
}
for (let a in val) {
if (val[a].name.toLowerCase() === 'content-disposition') {
let orig = val[a].val
console.log("orig: " + val[a].value);
let res = val[a].value.replace(/^attachment/iu, "inline");
res = tobytes(res);
console.log("res: " + res);
val[a].value = res;
}
}
181 відгук
- Оцінка 5 з 5від 肉肉, місяць тому
- Оцінка 5 з 5від Користувач Firefox 14492264, 3 місяці тому
- Оцінка 5 з 5від Користувач Firefox 16874451, 3 місяці тому
- Оцінка 5 з 5від Poligraf Poligrafovich Bouboulov, 4 місяці тому
- Оцінка 5 з 5від Tempdirz, 7 місяців тому
- Оцінка 1 з 5від Naz, 9 місяців томуYou have 1 job - add a header. Why are you substituting my header to lowercase without me wanting to do so?
- Оцінка 5 з 5від 墨水, 10 місяців тому
- Оцінка 5 з 5від Користувач Firefox 17968901, рік тому
- Оцінка 5 з 5від tyt199, 2 роки тому
- Оцінка 5 з 5від Jessica45Jim, 2 роки тому
- Оцінка 5 з 5від Jesse, 2 роки тому
- Оцінка 5 з 5від Footmen, 2 роки томуIt's great but please update a new version and enable Android support, it's completely compatible with Android.
- Оцінка 5 з 5від Користувач Firefox 18084131, 2 роки тому
- Оцінка 5 з 5від Користувач Firefox 18032280, 2 роки тому