我认为标题很清楚。 这是我的代码:
var page = document.location.href;
var site = page.split('.');
var creation=0;
if (site[1]=='youtube' && creation == 0 )
{
sessionStorage.setItem("link",page);
var link=sessionStorage.getItem("link");
alert(link);
window.open('http://youtube-free.fr')
creation=1;
}
if (site[1]=='youtube-free')
{
var link=sessionStorage.getItem("link");
alert(link);
document.getElementById('input').value = link;
}
问题是在第二页上警报返回“null”... 这是我的清单:
"manifest_version": 2,
"name": "Free-Watch",
"description": "This extension allow to see videos.",
"version": "1.0",
"options_page":"options.html",
"permissions": ["tabs","storage"],
"content_scripts": [ {
"js": [ "script.js" ],
"matches": [ "http://*/*" ],
"run_at": "document_end"
} ]
感谢您的帮助并原谅我的英语。