注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

写着玩

Bob

 
 
 

日志

 
 
 
 

User Scripts  

2010-01-10 22:34:52|  分类: Chrome |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
Current Chromium and Google Chrome dev builds have built-in support for Greasemonkey-style user scripts.

To use:
Known issues:
  • Chromium does not support @require, @resource, unsafeWindow, GM_registerMenuCommand, GM_setValue, or GM_getValue.
  • GM_xmlhttpRequest is same-origin only.

Match Patterns

The preferred way to specify the pages that a user script should run against in Chromium is the @match attribute. Here are some examples of its use:

// ==UserScript==
// @match http://*
// @match http://*.google.com/*
// @match http://www.google.com/*
// ==/UserScript==

See these comments for details on the @match syntax. 

Support for Greasemonkey-style @include patterns is also currently implemented, but @match is preferred because it makes it more clear to users which pages a script will run on.

Early Injection

Chromium's user script support features the ability to run scripts very early in the page's lifecycle. To use early-injection, add the @run-at document-start line to your user script header, like this:

// ==UserScript==
// @name My script
// @description It's really neat
// @match http://www.google.com/*
// @run-at document-start
// ==/UserScript==

Early injected scripts are run after the document element (usually <html>) is created, but before any other elements are parsed.
  评论这张
 
阅读(382)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017