firefox

POST和GET的区别(面试回答)

纵饮孤独 提交于 2021-01-31 13:40:53
POST和GET都是向服务器提交数据,并且都会从服务器获取数据。 区别: 1、传送方式:get通过地址栏传输,post通过报文传输。 2、传送长度:get参数有长度限制(受限于url长度),而post无限制 3、GET和POST还有一个重大区别,简单的说: GET产生一个TCP数据包;POST产生两个TCP数据包 长的说: 对于GET方式的请求,浏览器会把http header和data一并发送出去,服务器响应200(返回数据); 而对于POST,浏览器先发送header,服务器响应100 continue,浏览器再发送data,服务器响应200 ok(返回数据)。 也就是说,GET只需要汽车跑一趟就把货送到了,而POST得跑两趟,第一趟,先去和服务器打个招呼“嗨,我等下要送一批货来,你们打开门迎接我”,然后再回头把货送过去。 因为POST需要两步,时间上消耗的要多一点,看起来GET比POST更有效。因此Yahoo团队有推荐用GET替换POST来优化网站性能。但这是一个坑!跳入需谨慎。为什么? 1. GET与POST都有自己的语义,不能随便混用。 2. 据研究,在网络环境好的情况下,发一次包的时间和发两次包的时间差别基本可以无视。而在网络环境差的情况下,两次包的TCP在验证数据包完整性上,有非常大的优点。 3. 并不是所有浏览器都会在POST中发送两次包,Firefox就只发送一次

50道JavaScript基础面试题(附答案)

こ雲淡風輕ζ 提交于 2021-01-31 04:58:25
△ 是 新朋友 吗?记得先点 web前端学习圈 关注我哦~ 1 介绍JavaScript的基本数据类型 Number、String 、Boolean 、Null、Undefined Object 是 JavaScript 中所有对象的父对象 数据封装类对象:Object、Array、Boolean、Number 和 String 其他对象:Function、Arguments、Math、Date、RegExp、Error 新类型:Symbol 2 说说写JavaScript的基本规范? 1) 不要在同一行声明多个变量 2) 使用 ===或!==来比较true/false或者数值 3) switch必须带有default分支 4) 函数应该有返回值 5) for if else 必须使用大括号 6) 语句结束加分号 7) 命名要有意义,使用驼峰命名法 3 jQuery使用建议 1) 尽量减少对dom元素的访问和操作 2) 尽量避免给dom元素绑定多个相同类型的事件处理函数,可以将多个相同类型事件 处理函数合并到一个处理函数,通过数据状态来处理分支 3) 尽量避免使用toggle事件 4 Ajax使用 全称 :Asynchronous Javascript And XML 所谓异步,就是向服务器发送请求的时候,我们不必等待结果,而是可以同时做其他的事情

50道CSS基础面试题(附答案)

纵饮孤独 提交于 2021-01-31 04:20:52
https://segmentfault.com/a/1190000013325778 1 介绍一下标准的CSS的盒子模型?与低版本IE的盒子模型有什么不同的? 标准盒子模型:宽度=内容的宽度(content)+ border + padding + margin 低版本IE盒子模型:宽度=内容宽度(content+border+padding)+ margin 2 box-sizing属性? 用来控制元素的盒子模型的解析模式,默认为content-box context-box:W3C的标准盒子模型,设置元素的 height/width 属性指的是content部分的高/宽 border-box:IE传统盒子模型。设置元素的height/width属性指的是border + padding + content部分的高/宽 3 CSS选择器有哪些?哪些属性可以继承? CSS选择符:id选择器(#myid)、类选择器(.myclassname)、标签选择器(div, h1, p)、相邻选择器(h1 + p)、子选择器(ul > li)、后代选择器(li a)、通配符选择器(*)、属性选择器(a[rel="external"])、伪类选择器(a:hover, li:nth-child) 可继承的属性:font-size, font-family, color 不可继承的样式

Javascript: Firefox ignores dateStyle and timeStyle options in both Date.toLocaleString and Intl.DateTimeFormat

梦想的初衷 提交于 2021-01-29 22:28:51
问题 console.log(Intl.DateTimeFormat(undefined, {timeStyle: "long", dateStyle: "long"}).format()); Chrome says: "February 13, 2020 at 7:33:18 PM EST". Firefox says: "2/13/2020" Firefox also ignores dateStyle and timeStyle when using toLocaleString . var date = new Date(); console.log(date.toLocaleString(undefined, {timeStyle: "short", dateStyle: "short"})); console.log(date.toLocaleString(undefined, {timeStyle: "medium", dateStyle: "medium"})); console.log(date.toLocaleString(undefined, {timeStyle

“TypeError: Argument 1 of … is not a finite floating-point value” in Firefox

让人想犯罪 __ 提交于 2021-01-29 17:31:18
问题 I have a javascript code for clicking in mouse position (x/y) var elem = document.elementFromPoint( cursorX,cursorY ); elem.addEventListener('click', function() { console.log('clicked') }, false); var support = true; try { if (new MouseEvent('click', {bubbles: false}).bubbles !== false) { support = false; } else if (new MouseEvent('click', {bubbles: true}).bubbles !== true) { support = false; } } catch (e) { support = false; } var cursorX; var cursorY; cursorX = 0; cursorY = 0; document

Selenium does not install add-on in Firefox when using the addExtensions option

▼魔方 西西 提交于 2021-01-29 15:50:01
问题 I want to install a custom XPI file in Firefox when running it with selenium and geckodriver in a TypeScript and Jest context. The important part of the test script is this: let driver: webdriver.WebDriver; const firefoxExt = path.resolve(__dirname, '..', '..', 'extension', 'firefox.xpi'); const firefoxOptions = new firefox.Options().addExtensions(firefoxExt); driver = new webdriver.Builder().forBrowser('firefox').setFirefoxOptions(firefoxOptions).build(); I am expecting Firefox to launch and

setInterval() not working on firefox

三世轮回 提交于 2021-01-29 14:14:05
问题 Hi i'm quite new to java script and for some reason setInterval does not seem to work when i run this code on firefox . Ive tried running it on Microsoft edge but it still does not work. It just prints out the date once but does not continue from there. Any help would be appreciated. Thanks! <html> <head> </head> <body> <script type = "text/javascript"> <!--Intervals with Date/time--> function printTime(){ var now = new Date(); var hours = now.getHours(); var mins = now.getMinutes(); var

Actions click script - Selenium

别说谁变了你拦得住时间么 提交于 2021-01-29 08:01:10
问题 The code below is a selenium script I created with the Selenium IDE, I'm trying to get it to click 250 pixels from the technology button which should click the 'education' tab. You can see by running the script that the 'education' tab is highlighted as if its moused over but the console gives the error: org.openqa.selenium.WebDriverException: Element is not clickable at point (753.5, 107.51666259765625). Other element would receive the click Using: FireFox 45.0.0.1 Selenium Webdriver 2.53.1

Call Firefox helper functions from JS

一笑奈何 提交于 2021-01-29 07:39:56
问题 Firefox Web Console offers a screenshot helper function: :screenshot --selector '#element-id' --dpr 1 Probably a silly question, but is it possible to call this function from JavaScript at my website? Say, I have some button and it calls this: function downloadScreenshot() { if(navigator.userAgent.toLowerCase().indexOf('firefox') === -1) { alert("Firefox-only"); return; } eval(":screenshot --selector '#element-id' --dpr 1"); } If I try to run this I naturally get SyntaxError: expected

Call Firefox helper functions from JS

淺唱寂寞╮ 提交于 2021-01-29 07:31:07
问题 Firefox Web Console offers a screenshot helper function: :screenshot --selector '#element-id' --dpr 1 Probably a silly question, but is it possible to call this function from JavaScript at my website? Say, I have some button and it calls this: function downloadScreenshot() { if(navigator.userAgent.toLowerCase().indexOf('firefox') === -1) { alert("Firefox-only"); return; } eval(":screenshot --selector '#element-id' --dpr 1"); } If I try to run this I naturally get SyntaxError: expected