控制台中显示错误:TypeError:无法读取属性'焦点'为null。 console log显示正在运行的contentScript。
contentScript.js:
chrome.storage.sync.get('getText',function(data) {
var editor = document.getElementById('editText');
console.log('contentScript running');
editor.focus();
editor.select();
editor.value=data.getText;
});
webpage.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<textarea id="editText" rows="10" cols="50"></textarea>
</body>
</html>