每当我运行任何React应用时,都会弹出以下错误消息。
Uncaught TypeError: Cannot read property 'document' of undefined
at window.onload (content.js:5)
window.onload @ content.js:5
load (async)
(anonymous) @ content.js:1
content.js中的内容是
window.onload=function()
{
//Create an object for the frame
var firstFrame = window.parent.frames[0].document;
//Set JQuery events to run in the context of the frame
$("#transliterateDiv", firstFrame).html("check");
chrome.storage.local.get('typeNepaliContents', function(result){
data = result;
});
}
代码不会打扰React工作流程,但是错误仍然困扰着我。什么是快速解决方案?