node.js - Browserify bundled node js file in chrome extension throws the following error. -
i'm new javascript, i'm trying build chrome extension scraper using node , html, here's part of code javascript file
var request = require('request'); var cheerio = require('cheerio'); var href; var text; request("http://url", function (error, response, html) { if (!error && response.statuscode == 200) { var $ = cheerio.load(html); $("a.hp-article-link").each(function(i, element){ text = $(this).text(); href = $(this).attr("href"); console.log(text); console.log(href); } ); } });
if run code in console using node retrieves hrefs , corresponding text, when bundle using browserify , try browser throws cannot fetch absolute path error
here's complete error in browser console
fetch api cannot load chrome-extension://url. url scheme must "http" or "https" cors
here's link images of console , line throwing error in concern
Comments
Post a Comment