You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
how can I use declarativeNetRequest to redirect to a url create by "createObjectURL"?
I try to make an extension to mock json data for some axios.get api.I use the code below to insert a function into page and form a url like "blob:http://xxxx/xxxx'
//in popup.js
const generateUrl=()=>{
const o = { name: 'test', age: '18' }
const s = JSON.stringify(o);
const b = new Blob([s], { type: 'application/json' })
const u = window.URL.createObjectURL(b);
chrome.runtime.sendMessage({type:'ENABLE_PROXY', data: u }, (response) => {});
}
chrome.scripting.executeScript({
target: { tabId: tab.id },
func: generateUrl
})
however it doesn't make sense——I original use 'axios.get('http://127.0.0.1:8881') in a react-app,and it dose redirect the url create by 'createObjectURL' but can't recieve response correctly.
then I tried to send a xhr in chrome-dev-console,it recieved the json object
then I try to modify requestHead and responseHead by declarativeNetRequest,also can't solve this problem.
how can I use declarativeNetRequest to redirect to a url create by "createObjectURL"?
I try to make an extension to mock json data for some axios.get api.I use the code below to insert a function into page and form a url like "blob:http://xxxx/xxxx'
then I update rules in background.js
however it doesn't make sense——I original use 'axios.get('http://127.0.0.1:8881') in a react-app,and it dose redirect the url create by 'createObjectURL' but can't recieve response correctly.
then I tried to send a xhr in chrome-dev-console,it recieved the json object
then I try to modify requestHead and responseHead by declarativeNetRequest,also can't solve this problem.
I notice in blog https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-ModifyHeaderInfo it says that
I 'm not sure whether that means it is not support to run like my code
how can I use declarativeNetRequest to redirect to a url create by "createObjectURL"?
The text was updated successfully, but these errors were encountered: