Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140012

err_file_not_found error in loading a page in extension

$
0
0

I am trying to load the same link of the tab into the popup window (this is not my primary purpose and i am doing this just to get acquainted) I am getting the error

Failed to load resource: net::ERR_FILE_NOT_FOUND

My js file is as follows

var pageGenerator = {
    requestPage: function() {
        var urlTosearch;
        chrome.windows.getCurrent(function(w) {
            chrome.tabs.getSelected(w.id,
            function (response){
                urlTosearch = response.url;
            });
        });
        var req = new XMLHttpRequest();
        req.open("GET", urlTosearch, true);
        req.onload = this.loadPage_.bind(this);
        req.send(null);
    },
    loadPage_: function (e) {
        var resp = e.target.responseText;
        document.body.insertAdjacentHTML( 'beforeend', resp);
    }
};
document.addEventListener('DOMContentLoaded', function () {
   pageGenerator.requestPage();
});

I have read that external pages can not be loaded onto the popup. Is it so? If true why? and if not how can it be done?


Viewing all articles
Browse latest Browse all 140012

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>