chrome 插件学习
2016-03-10 15:42
351 查看
直接在 background.js
getPrice(); //直接运行 function handleError() { } function getPrice(){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4){ if(xhr.status==200){ //表示服务器端的响应代码是200,正确的返回了数据 //纯文本数据的接受方法 //var message=xmlhttp.responseText; console.log(xhr.responseText); } } }; xhr.open("GET", "http://demo.com", true); xhr.send(null); //console.error(xhr.response); } chrome.browserAction.setBadgeText({text:"1234"}); //插件icon添加文字
定时 var priceInterval = window.setInterval(function() { self.getPrice();}, 30000); }
相关文章推荐
- Tomcat服务绑定域名的方法
- Java Hashmap中元素的顺序问题
- 设置activity切换动画
- 191. Number of 1 Bits
- Mysql查找如何判断字段是否包含某个字符串
- pcl 1.8.0(5) VTK编译
- mysqlcppconn之ConnectOptionsMap的使用
- 联系苹果必备!App Store官方邮箱列表大全
- 用NSFileManager实现文件夹占内存计算
- Flex 布局教程:语法篇
- ID3决策树的Java实现
- 利用 CURL 发送JSON格式字符串
- Dynamics CRM The difference between UserId and InitiatingUserId in Plugin
- iOS 【automaticallyAdjustsScrollViewInsets 属性介绍】
- sqlserver,oracle,mysql等的driver驱动,url怎么写
- 关于dispatch_semaphore的使用
- Android的animation动画
- centOS 7 安装 MySQL5.7.11
- 深入理解hadoop(一)
- Dynamics CRM The difference between UserId and InitiatingUserId in Plugin