使用内置javascript对象的简单示例:navigator.my_new_property ="some value"; //我们可以检测到这个新属性被添加了吗?
我不想经常轮询对象以检查新属性.是否有某种类型的更高级别的对象设置器而不是显式声明要监视的属性?
同样,我不想检测属性值是否更改,而是在添加新属性时.
想法?谢谢
是否可以在运行时确定这一点?
external.js 的内容:
function x() {
//can i get the path/name of the html file that included this js file?
//which is test.html
}
Run Code Online (Sandbox Code Playgroud)
test.html 的内容
脚本 src="external.js"