gecko

替代传统XMLHttpRequest的fetch方法实现ajax

折月煮酒 提交于 2019-12-05 19:29:06
FETCH API提供了一个JavaScript接口,用于访问和操作HTTP管道的某些部分,例如请求和响应。它还提供了一种全局fetch()方法,它提供了一种简单、逻辑的方法来跨网络异步地获取资源。 与jquery.ajax()方法不同的两点: 1、即使响应返回404、500等错误,它也不会出错,只会返回一个网络错误。 2、默认情况下,fetch不会发送和返回cookie。但可以通过初始化参数添加这项功能,var init = {credentials: 'include' // 请求带上cookies}。这点在需要权限验证的操作时一定要注意。 基础用法: fetch('http://example.com/movies.json') .then(function(response) { return response.json(); }) .then(function(myJson) { console.log(myJson); }); Supplying request options // Example POST method implementation: postData(`http://example.com/answer`, {answer: 42}) .then(data => console.log(data)) // JSON from `response

HTTP协议简介

我的未来我决定 提交于 2019-12-05 15:18:53
1. 什么是HTTP协议 超文本传输协议(HTTP,HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议,是一个基于请求与响应模式的、无状态的、应用层的协议,常基于TCP的连接方式。 1.1 HTTP协议的主要特点如下 1.支持客户端/服务器模式。 2.简单快速:客户向服务器请求服务时,只需传送请求方法和路径。请求方法常用的有GET、POST。每种方法规定了客户与服务器联系的类型不同。由于HTTP协议简单,使得HTTP服务器的程序规模小,因而通信速度很快。 3.灵活:HTTP允许传输任意类型的数据对象。传输的类型由Content-Type加以标记。 4.无连接:无连接的含义是限制每次连接只处理一个请求。服务器处理完客户的请求,并收到客户的应答后,即断开连接。采用这种方式可以节省传输时间。 5.无状态:HTTP协议是无状态协议。无状态是指协议对于事务处理没有记忆能力。缺少状态意味着如果后续处理需要前面的信息,则它必须重传,这样可能导致每次连接传送的数据量增大。另一方面,在服务器不需要先前信息时它的应答就较快。 2. Http协议的通信 HTTP通信机制是在一次完整的HTTP通信过程中,Web浏览器与Web服务器之间将完成下列7个步骤 1、 建立TCP连接 在HTTP工作开始之前,Web浏览器首先要通过网络与Web服务器建立连接

Gecko API for DOM

微笑、不失礼 提交于 2019-12-05 13:37:36
Does Gecko expose an API for working directly with its DOM? I'm looking for a class like HtmlElement that can be used to build/traverse trees of HTML content. I'm trying to host Gecko as a web browser control in a desktop application, and would prefer a direct API rather than going through COM. Thanks! Yes, virtually all of the classes relating to the DOM are exposed through XPCOM . In fact, I believe the entire functionality of Gecko is exposed this way. greyfade: whilst your answer is technically correct, i've found that the gecko DOM API is incredibly hard to find, because of all the

How do I embed Gecko using gecko-sharp on Mono/Windows?

青春壹個敷衍的年華 提交于 2019-12-05 07:27:33
Gecko is the rendering engine for Firefox. Using gecko-sharp it is possible to embed it to any Mono/GTK# program. There is a sample application called GladeSharpBrowser for doing this. I could manage to build it using a modified project file, but it is crashing. This sould help you reproduce the problem: I have used SharpDevelop 3.0 and a tutorial to set it up with my Mono 2.2 installation. I have made sure it calls Mono's gmcs for compilation using ProcMon. After setting up SharpDevelop, the BrowserSharp.csproj had to be modified so it compiles with Mono. There is also a warning message:

How do I get past “Gecko engine crashed.;Gecko engine crashed.;Gecko engine crashed.;” error after upgrading abcPDF

痞子三分冷 提交于 2019-12-05 04:18:04
问题 I recently upgraded abcPDF from v8.1.0.7 to v8.1.1.1 (and then later from v8.1.1.1 to v8.1.1.2). After the upgrades, I got errors similar to the following whenever I tried to generate a PDF: "Gecko engine failed to render the page: Gecko engine crashed.; Gecko engine crashed...;" "Failed to add HTML:Gecko engine crashed.; Gecko engine crashed.; Gecko engine crashed..." We're using the Gecko engine (instead of the default MSHTML engine) to render PDFs. We didn't get the error message until

How does Gecko (or any other layout engine) render a document/page?

夙愿已清 提交于 2019-12-05 03:48:48
问题 It was kind of hard to go through Gecko's documentation to see how it renders a web page. I'm doing some performance analysis for my projects across the leading browsers to see how to improve response time. I am aware of optimization techniques out there but I don't really understand their basis — which I believe would be resolved if I knew how browser engines do their thing. 回答1: I gave a tech talk on material that might be useful a few years ago. It wasn't the best of presentations, but I

Typed Arrays in Gecko 2: Float32Array concatenation and expansion

狂风中的少年 提交于 2019-12-04 23:50:41
I'm a bit confused with Javascript Typed Arrays . What I have are several Float32Array s, that have no concat method. I don't know how many are them in advance, btw. I'd like to concatenate them all inside another Float32Array, but: as I said before, there is no concatenation method if I try to write past the array length, the array is not expanded (aka this won't work - please note that event.frameBuffer and buffer are both Float32Array and that I don't know what the final length of my buffer will be): var length_now = buffer.length; for (var i = 0; i < event.frameBuffer.length; i += 1) {

getUserMedia for Firefox OS

こ雲淡風輕ζ 提交于 2019-12-04 16:52:05
It was said that getUserMedia would land on Firefox OS 1.2 . I have read the documentation and tried to look for it in the Google Groups, but I have not found anything related to it. I have developed a web app that works on Firefox Nightly (so, it works in Gecko): But when I try to use it in Firefox OS 1.4, I get a "Permission denied" error: I have tried to add the following permission to the manifest: "permissions":{ "camera":{} } But didn't solve the problem. Is there any other permission that I would need to add? getUserMedia support for the microphone landed in FxOS v1.2. getUserMedia

Fill a select box using geckofx c#

北慕城南 提交于 2019-12-04 16:28:14
I am using the code: ((GeckoSelectElement) geckoWebBrowser1.Document.GetElementById("OA0001_dob_month")).Value = "Jul"; But its not working. How to select a value in a selectbox in geckofx c# without using the jscontext? To select a value by index: var document = GeckoWebBrowser1.Document; var selectElement = (GeckoSelectElement)document.GetElementById("OA0001_dob_month"); selectElement.SelectedIndex = 2; 来源: https://stackoverflow.com/questions/33259192/fill-a-select-box-using-geckofx-c-sharp

highlight the text of the DOM range element,

限于喜欢 提交于 2019-12-04 16:15:12
I am able to highlight the text on the HTML page(rendered through gtkmozembed), which is selected, like below. var range, sel; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt) { range = sel.getRangeAt(0); } document.designMode = "on"; if (range) { sel.removeAllRanges(); sel.addRange(range); } document.execCommand("HiliteColor", false, colour); document.designMode = "off"; } Well,it works very fine.Now i am trying to store the information(startNode, startOffset,endNode, endOffset) about the highlighted text, and next time when i open the same page,highlight the same