谷歌浏览器扩展程序 - 等待页面加载 [英] Google Chrome Extension - waiting until page loads

查看:662
本文介绍了谷歌浏览器扩展程序 - 等待页面加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Google Chrome扩展程序中,我有一个内容脚本(内容。 js)和背景页(background.html)。我有context.js检查页面上显示的关键字。但是,我希望等到页面完全加载后才能搜索页面,因为关键字可能出现在页面的底部。

In my Google Chrome Extension, I have a Content Script (content.js) and a Background Page (background.html). I have context.js checking for a keyword that appears on the page. However, I want to wait until the page is fully loaded until I search the page, because the keyword may occur at the bottom of the page.

请参阅按内容 sandwich示例(文件),这基本上是我在做什么。如果你加载扩展名,你会看到扩展名仅在页面顶部出现单词sandwich时才起作用。

See Page action by content sandwich example (files), this is basically what I am doing. If you load the extension you'll see the extension only works when the word "sandwich" appears at the top of the page.

推荐答案

<

"run_at": "document_end"

http://code.google.com/chrome/extensions/content_scripts.html

这篇关于谷歌浏览器扩展程序 - 等待页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆