You are using it correctly - though you don't need to wrap it inside(您正确使用了它-尽管不需要将其包装在里面)
javascript:(function() { }
Anyway, this is the important part of the error message:(无论如何,这是错误消息的重要部分:)
TypeError: undefined is not an object(TypeError:未定义不是对象)
This merely means the object for which you're trying to modify the style attribute doesn't exist.(这仅表示您要修改其style属性的对象不存在。)
If you try the following code(如果您尝试以下代码)
_myController.evaluateJavascript("console.log(document.documentElement.innerHTML);");
setState(() {
_loadedPage = true;
});
and take a look at the debug console, you'll notice that this code - which should return the complete HTML for the stackoverflow website - just returns a little bit and not enough to reach the header element which uses the class top-bar js-top-bar top-bar__network _fixed
.(再看一下调试控制台,您会注意到该代码-应该返回stackoverflow网站的完整top-bar js-top-bar top-bar__network _fixed
仅返回一点,不足以到达使用类top-bar js-top-bar top-bar__network _fixed
的header元素。 top-bar js-top-bar top-bar__network _fixed
。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…