cross-browser

Is there a cross-browser, backwards compatible way to code a background gradient?

允我心安 提交于 2019-12-12 19:19:09
问题 I've been looking for a solution to background gradients that work in modern browsers and versions of IE down to 7. If someone has a best practice that works, I would appreciate the method as I keep running into solutions that break on a certain browser or version. It should atleast work in IE7-9, Firefox, Safari, Opera, and Chrome. 回答1: As other have said, CSS3 is compatible with FF, Chrome etc. For IE9, you can use their official CSS Gradient Background Maker, which will generate an inline

How can I gracefully degrade CSS viewport units?

落爺英雄遲暮 提交于 2019-12-12 18:17:06
问题 CSS viewport units ( vw , vh , vmin , vmax ) are great, and I want to start using them for fonts -- but I noticed here that they aren't that widely supported. I tried to google any best practices for graceful degradation in unsupported browsers, but couldn't find anything useful. Are there any better ways beyond doing something like: h1 { font-size: 120%; /* for unsupported browsers */ font-size: 5.3vmin; /* for supported browsers */ } Thanks in advance! 回答1: Native usage You'll at least want

HTML5-style script-tags in older browsers

落花浮王杯 提交于 2019-12-12 17:51:18
问题 It has been stated that in HTML 5 it's OK to use script -tags for Javascript without any attributes , like this: <script> // the javascript here </script> With other features in HTML 5 you can use different kind of poly-fills to bridge what old browsers don't know about HTML 5, but can above script -tag have any side-effect in any old browser ? UPDATE : Let's set the limit at IE6 and above, along with Firefox 2 and above , to have something concrete. 回答1: This is fine everywhere - the default

What is the equivalent of IE's removeNode

泄露秘密 提交于 2019-12-12 17:44:33
问题 IE's removeNode http://msdn.microsoft.com/en-us/library/ms536708(VS.85).aspx helps me to decide whether I would like to remove childNodes or not. I would like to know whether the same exists for Firefox, Opera, Chrome and Safari. If not, how can I achieve it? 回答1: Didn't want just just copy code over, give this a read: http://www.sitepoint.com/forums//showthread.php?p=947385 Edit (but I, pst, have no shame -- code from above link ;-) if ( window.Node ) Node.prototype.removeNode = function(

HTML type=“search” detect clear button support

我们两清 提交于 2019-12-12 17:26:08
问题 In HTML5 we have the <input type="search" /> which acts differently on multiple browsers. Webkit adds a clear button when text is added and Firefox does not. Is there a way; other than browser sniffing, to detect if the clear button is supported by the browser? 回答1: Best answer I can come up with at the moment. It is one level under browser sniffing. It can break easily with browser upgrades or users changing the default behavior with generic CSS rules. <!DOCTYPE html> <html> <head> <meta

How to make CSS border-image work

孤者浪人 提交于 2019-12-12 17:20:29
问题 I am stuck with borders on my website. I want to put an image at the top of my vertical menu, one at the bottom and a background for the middle but that doesn't work. This is my code: .border-image { border: solid transparent 10px; //I tried with and without this line border-top-image: url(/pictures/menu_top.png) 10 round round; border-bottom-image: url(/pictures/menu_bottom.png) 10 round round; } #menu_left { background-image: url(/pictures/menu_middle.png); background-repeat:repeat-y; } I

Testing compatibility for javascript 1.2

僤鯓⒐⒋嵵緔 提交于 2019-12-12 17:02:54
问题 At work, We use a pretty old browser(symbol's pocket browser) that supports only JS 1.2. Deploying code to the test device running that browser is a bit painful. Is there any open source/free tool available that would allow me to check locally in a PC (running Windows XP/Firefox 3.6.8) whether the code written is compatible with JS 1.2? Thanks in advance. 回答1: You could try using <script language="JavaScript1.2"> . Source: http://docstore.mik.ua/orelly/webprog/jscript/ch20_02.htm 来源: https:/

How to use Modernizr classes?

天涯浪子 提交于 2019-12-12 16:32:58
问题 I am new to modernizr. I read some documentation on modernizr, and I wanted to set border: none if browser doesn't support CSS3 box-sizing: border-box . I tried: li { border-right: 1px solid #eee } .css-boxsizing li { border: none } But it didnt work out. Can any1 suggest something? 回答1: In Modernizr, supported features are added as a class name to the root element. After inspecting the list of classes at http://modernizr.github.com/Modernizr/test/, I've found the correct class name to be

How to clear Firefox' console via javascript?

▼魔方 西西 提交于 2019-12-12 16:18:39
问题 I have some functions that when executed show some info with console.log() . There is no problem with that. But, some times, the console looks strange... Because that, they sent me to clear the console when pressing 'l' (letter 'L' in lowercase). I took it as a simple task, I just needed to use console.clear() and all would be fine. But... I only thought: console.clear(); // doesn't work in firefox !!! In chrome it works fine. Fiddle here. Does someone knows any technique to do this in

Link to a PDF in html, the file has no extension, but I know it is pdf how to make it open appropriately

大城市里の小女人 提交于 2019-12-12 16:16:55
问题 First post. I'm working on a project for a client where they have pdf files uploaded to a file structure (LAMP Stack) but the files have no extensions on them. Under the assumption that those files have to be PDF how would I get the browsers to understand that, and open them accordingly? Obviously with adding the file extensions this would suddenly work but I can't change the way their system works, it would result in too many changes and they are on a tight deadline. As for saving a