不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
Chrome扩展程序Content Scripts无法调用页面中的脚本!
编辑:dnawo 日期:2010-06-15
关于Content Scripts的权限,在Chrome Extensions官方文档中已有说明:
在刚开始制作Chrome Extensions时,老没记住,就做了个测试:
manifest.json:
CallFun.js:
Index.htm:
预览效果:
引用内容
Here are some examples of what content scripts can do:
·Find unlinked URLs in web pages and convert them into hyperlinks
·Increase the font size to make text more legible
·Find and process microformat data in the DOM
However, content scripts have some limitations. They cannot:
·Use chrome.* APIs (except for parts of chrome.extension)
·Use variables or functions defined by their extension's pages
·Use variables or functions defined by web pages or by other content scripts
·Make cross-site XMLHttpRequests
·Find unlinked URLs in web pages and convert them into hyperlinks
·Increase the font size to make text more legible
·Find and process microformat data in the DOM
However, content scripts have some limitations. They cannot:
·Use chrome.* APIs (except for parts of chrome.extension)
·Use variables or functions defined by their extension's pages
·Use variables or functions defined by web pages or by other content scripts
·Make cross-site XMLHttpRequests
在刚开始制作Chrome Extensions时,老没记住,就做了个测试:
manifest.json:
复制内容到剪贴板 程序代码
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"content_scripts": [
{
"matches": ["http://localhost/Index.htm"],
"js": ["CallFun.js"]
}
]
}
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"content_scripts": [
{
"matches": ["http://localhost/Index.htm"],
"js": ["CallFun.js"]
}
]
}
CallFun.js:
复制内容到剪贴板 程序代码
try{ShowTime();}catch(e){alert("error: " + e.message);}
Index.htm:
复制内容到剪贴板 程序代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Content Scripts测试-Mzwu.Com</title>
</head>
<body>
<script language="Javascript" type="text/javascript">
function ShowTime()
{
alert((new Date()).toLocaleDateString());
}
</script>
<input id="btnShowTime" type="button" value="click" onclick="ShowTime();" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Content Scripts测试-Mzwu.Com</title>
</head>
<body>
<script language="Javascript" type="text/javascript">
function ShowTime()
{
alert((new Date()).toLocaleDateString());
}
</script>
<input id="btnShowTime" type="button" value="click" onclick="ShowTime();" />
</body>
</html>
预览效果:
上一篇: Free HTTP Sniffer:Access violation at address xxxx解决方法
下一篇: SqlDataAdapter查询超时设置
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
下一篇: SqlDataAdapter查询超时设置
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
评论: 0 | 引用: 0 | 查看次数: 8757
发表评论
请登录后再发表评论!