WebExtension- chrome.extension.sendRequest is not a function

Hi,

I have a chrome extension and i’m going to make it to Firefox webExtension.
But i get a error message on firefox:
chrome.extension.sendRequest is not a function

After i google, It’s seem a bug ?
Any suggestion?
Thank you

By the way, I can not put a link on this post, but the tip say new user can put 5 link on the post.

1 Like

You should use chrome.runtime.sendMessage and chrome.runtime.onMessage for messaging. The chrome.extension.sendRequest method is deprecated in Chrome and thus not even implemented in Firefox.

Thank you , but i need to get a http requests from server,what method should I use?
i search a lot, but can not get a answer for that, can you give me a example?

Thank you

You can use XMLHttpRequest or fetch alike. They will be privileged and thus ignore things like CORS.

Thank you very much, it’s work for me