mozilla

Finding the tab associated with a DOM window

我只是一个虾纸丫 提交于 2019-11-27 02:52:41
问题 I'm adding some new functionality in a Firefox extension, TryAgain, that traps HTTP error codes (e.g. 500) and automatically retries loading the page after some interval. Trapping the codes works excellently, and I'm trying to tally the total number of retries and store this in the tab using Session Store. Unfortunately, right now I'm getting a reference to a DOM window (through interfaceRequestor.getInterface(Components.interfaces.nsIDOMWindow) ), but I need a reference to a tab, which is a

Is WebRTC implemented in any browsers yet?

落花浮王杯 提交于 2019-11-27 02:51:58
问题 Is WebRTC implemented in any browsers yet? Nightly builds? Thanks for any info. 回答1: Note : This answer is outdated, see answers below for current information. Do you accept "No" as an answer? It seems to be a project in early stages and their blog has only a few entries - if any browser vendor adopted their solution I would expect to see a big announcement there. So far they only have a blog post titled "First Step Toward Chrome Integration" which seems to indicate that some prerequisites

【常见浏览器的UA】 -- 2019-08-12 13:00:20

落爺英雄遲暮 提交于 2019-11-27 02:48:49
原文: http://106.13.73.98/__/82/ 所谓 UA(User Agent / 用户代理),最初是指浏览器告知网站管理员,本浏览器支持的类型和框架,让网站管理员以支持的模式结构向浏览器发送页面,呈现给用户浏览。演变到今天,网站管理员为了给用户带呈现最佳的页面效果,为了使不同浏览器展现同样的网站页面,通过浏览器获取用户的系统信息,包括硬件平台、系统软件、应用软件和用户个人偏好,然后通过服务器解析后以适合用户的页面类型发送到浏览器。 Python UA库 # 安装 pip install fake-useragent # 使用 from fake_useragent import UserAgent ua = UserAgent() # 随机谷歌UA chrome = ua.Chrome # 随机IE的UA ie = ua.ie # 随机火狐UA firefox = ua.Firefox # 随机浏览器的UA firefox = ua.random # 忽略大小写的,比如:ua.ie可写成ua.IE # 如果实例化时出现报错,可尝试以几种方式实例化: # ua = UserAgent(use_cache_server=False) # ua = UserAgent(cache=False) # ua = UserAgent(verify_ssl=False)

nodejs express搭建服务器(爬虫知乎精华帖,个人学习用)二 找到每一类话题中的精华帖的链接

久未见 提交于 2019-11-27 02:23:57
var cheerio = require('cheerio'); var iconv = require('iconv-lite'); var https= require('https'); var mysql = require('mysql'); var limit = 10; var offset = 0; var question_url = 'https://www.zhihu.com'; var base_url1 = 'https://www.zhihu.com/api/v4'; var base_url2 = '/feeds/essence?include=data%5B%3F%28target.type%3Dtopic_sticky_module%29%5D.target.data%5B%3F%28target.type%3Danswer%29%5D.target.content%2Crelationship.is_authorized%2Cis_author%2Cvoting%2Cis_thanked%2Cis_nothelp%3Bdata%5B%3F%28target.type%3Dtopic_sticky_module%29%5D.target.data%5B%3F%28target.type%3Danswer%29%5D.target.is

一个非常有趣的爬虫小练习带ocr识别的

青春壹個敷衍的年華 提交于 2019-11-27 00:20:22
有个小的想法,想找一找 形近字 。百度一搜索,百度文库有一个,收费4元。而且我觉得字数不是太多。想自己弄一个,于是找到了 这个网站 http://www.fantiz5.com/xingjinzi/ 这里面据说字数很多,开练! 主要是为了学习 chrome,开发者调试 发现 有个 zhuan() 的js 找到这个函数 找到这个函数了,开始研究里面的代码 意思是 把输入的汉字 如 ‘中’ ,转化为 url编码 再去掉 % ,再转换成 小写。 再看这行代码,把转后的结果 拼字符串,直接访问。 如: http://www.fantiz5.com/xingjinzi/json/e4b880.html 好了,研究明白了,开始爬吧。可是输入的汉字从哪里来呢? 看到上面有一堆字,大概6700多个,就用这些字,作为输入吧。 直接上代码: 1 # coding=gbk 2 3 # 爬取形近字网站 4 # http://www.******.com/xingjinzi/ 5 6 7 import urllib 8 import os,re 9 import pickle 10 from urllib import request, parse 11 import chardet 12 import requests 13 import random 14 import time 15 from bs4

【常见浏览器的UA】 -- 2019-08-11 19:21:02

给你一囗甜甜゛ 提交于 2019-11-27 00:13:07
原文: http://106.13.73.98/__/82/ 所谓 UA(User Agent / 用户代理),最初是指浏览器告知网站管理员,本浏览器支持的类型和框架,让网站管理员以支持的模式结构向浏览器发送页面,呈现给用户浏览。演变到今天,网站管理员为了给用户带呈现最佳的页面效果,为了使不同浏览器展现同样的网站页面,通过浏览器获取用户的系统信息,包括硬件平台、系统软件、应用软件和用户个人偏好,然后通过服务器解析后以适合用户的页面类型发送到浏览器。 Python UA库 # 安装 pip install fake-useragent # 使用 from fake_useragent import UserAgent ua = UserAgent() # 随机谷歌UA chrome = ua.Chrome # 随机IE的UA ie = ua.ie # 随机火狐UA firefox = ua.Firefox # 随机浏览器的UA firefox = ua.random # 忽略大小写的,比如:ua.ie可写成ua.IE # 如果实例化时出现报错,可尝试以几种方式实例化: # ua = UserAgent(use_cache_server=False) # ua = UserAgent(cache=False) # ua = UserAgent(verify_ssl=False)

Why do different browsers render the same HTML differently?

倖福魔咒の 提交于 2019-11-27 00:04:24
问题 This is an html page : <html> <head> <title> Frame Set </title> <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <link rel="stylesheet" href="frame.css" type="text/css" media="screen" /> <script language="JavaScript" type="text/javascript"> $(document).ready(function() { var winSize = $(window).width(); var margin = (winSize-1000)/2;; $('#main').css({'margin-left':margin,'margin-right':margin}); } ) $(function() { $(".frame").each(function() { var width = ($(this).find('.h')

Javascript - Assigning multiple variables to object properties using curly braces in variable declaration

有些话、适合烂在心里 提交于 2019-11-26 23:21:13
问题 While looking at some Javascript code for Mozilla's (Firefox) Add-on SDK, I saw kind of variable declaration I hadn't seen before: var { foo, bar } = someFunction("whatever"); // just an example See those curly braces around the variable name? Turns out, this is a way of assigning the values of properties of an object to multiple variables all at once. It seems similar to destructuring assignment or PHP's list, except with object properties instead of arrays. I actually found this out through

IE input file atribute is undefined

大城市里の小女人 提交于 2019-11-26 21:40:24
问题 I have the following input file tag: <input type="file" id="handlerxhr1" /> In mozilla when I run the following jQuery code: var input = $('#handlerxhr1')[0]; $('#upload').click(function() { alert(input.files[0]); }); I get response: [object File] (which is good). But in IE I get 'input.files.0 is undefined' What am I doing wrong? Thanks. 回答1: This seems good enough... $(function() { var input = $('#handlerxhr1')[0]; $('#upload').click(function() { alert(input); }); }); Not sure if your were

java的http连接中,如何改变User-Agent

青春壹個敷衍的年華 提交于 2019-11-26 21:23:15
java 的 URLConnection能够方便我们获取internet/intranet上的资源。而HttpUrlConnection 则是特别为我们连接http服务器,上传数据,下载文件而设计的;HttpUrlConnection会为我们组织正确的http头信息并传送给服务器,然后再从服务器上下载我们想要的内容。可以说,HttpUrlConnection为我们连接http省了很多事情,但是如果我们要自己更改里面的细节就费事了。比如更改:User-Agent头。 有很多的方法可以实现,最简单的就是更改System Property. System.setProperty("http.agent", Your_Http_Agent_Value); 附上浏览器user agent大全 淘宝浏览器2.0 on Windows 7 x64: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11 猎豹浏览器2.0.10.3198 急速模式on Windows 7 x64: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML,