日期:2014-05-16  浏览次数:20354 次

chrome插件JavaScrpt问题
mainframe.json 放着安装消息
如下:

  "name": "MouseButton+", 
  "version": "0.1", 
  "description": "You can use the right mouse button in the page", 
  "browser_action": 
  { 
  "default_icon": "icon.gif", 
  "popup": "popup.html" 
  }
}


我把我要用的js代码写在两个文件里
//popup.html
<head>
  <script type="text/javascript" src="mouse_right.js"></script>
</head>

//-----------------------------------------
//mouse_right.js
alert(document.oncontextmenu='')





然后载入chrome发现没效果。
我想应该是该js在popup.html里运行了,但是并没有在当前打开的网页生效。
我这么说对吗?

怎么修改呢?

------解决方案--------------------
子窗口外联的js文件,不经过处理,父窗口是没有效果的