简体   繁体   中英

Javascript: get <img> src and set as return "" address?

function getFavicon(){
     return "http://example.png"
}

This code is the only one that works for me. When I try to change the url within that to a code like " return "chrome.extension.getBackgroundPage().imageSrc[0]"" it shows nothing... can someone please help me?

try this.

function backgroundFunction () {
    return "http://example.png" 
}

(function () {
    var otherWindows = chrome.extension.getBackgroundPage();
    console.log(otherWindows.backgroundFunction()); 
})();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM