0

I'm creating one simple API for getting data on Firebase. But when I run try to make POST REQUEST to API in ChromeExtension, it block request with this error :

jquery.js:2 Cross-Origin Read Blocking (CORB) blocked cross-origin response http://localhost:3000/get with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details

I have tried deploy API on hosting but nothing changed.

There my code index.js on server

const express = require('express');
const app = express();

app.post('/get', (req, res) => {
  res.json({asd:123});
});

app.post('/test', (req, res) => {
  res.send("abc")
});

app.listen(3000);

content.js in extension

   $.post("http://localhost:3000/get",data => {
      console.log(data);
   });

manifest.json in extension

{
   "manifest_version": 2,
   "name": "FUNiX Onpage Editor",
   "description": "This extension used to edit content which translated by FUNiX.",
   "version": "0.2",
   "content_scripts": [{
      "matches": [
         "http://*/*",
         "https://*/*"
      ],
      "js": [
         "script/content.js"
      ]
   }],
   "permissions": [ "tabs", "http://*/*", "https://*/*", "storage" ]
}

Did anyone fix this problem before?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

0 Answers0