cross-browser

Easiest way to retrieve cross-browser XmlHttpRequest

与世无争的帅哥 提交于 2019-12-17 02:28:47
问题 What is the easiest and safest way to retrieve XmlHttpRequest object that works across all browsers? Without any extra libraries. Is there a code snippet you use often? P.S. I know there are tons of examples on the net, but this is precisely the reason I am asking: there are too many different examples, and I just want something simple and proven to work. jQuery and other libraries is NOT an option. Why does jquery leak memory so badly? 回答1: While I would recommend using a full library to

How can I prevent the backspace key from navigating back?

我是研究僧i 提交于 2019-12-17 02:07:09
问题 On IE I can do this with the (terribly non-standard, but working) jQuery if ($.browser.msie) $(document).keydown(function(e) { if (e.keyCode == 8) window.event.keyCode = 0;}); But is it possible to do in a way which works on Firefox, or in a cross-browser way for a bonus? For the record: $(document).keydown(function(e) { if (e.keyCode == 8) e.stopPropagation(); }); does nothing. $(document).keydown(function(e) { if (e.keyCode == 8) e.preventDefault(); }); solves the problem, but renders the

Browser statistics on JavaScript disabled [closed]

折月煮酒 提交于 2019-12-17 00:00:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I am having a hard time collecting publically available statistics on the percentage of web users that browse with JavaScript disabled. Yahoo has published data from 2010 and R. Reid published data from 2009 (picked from a site he had access to). The findings from Yahoo were rather interesting at that time: We

Show datalist labels but submit the actual value

点点圈 提交于 2019-12-16 23:55:35
问题 Currently the HTML5 <datalist> element is supported in most major browsers (except Safari) and seems like an interesting way to add suggestions to an input. However, there seem to be some discrepancies between the implementation of the value attribute and the inner text on the <option> . For example: <input list="answers" name="answer"> <datalist id="answers"> <option value="42">The answer</option> </datalist> This is handled differently by different browsers: Chrome and Opera: FireFox and IE

Cross Browser Flash Detection in Javascript

我的未来我决定 提交于 2019-12-16 22:23:14
问题 Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not possible 100% of the time. 回答1: SWFObject is very reliable. I have used it without trouble for quite a while. 回答2: I agree with Max Stewart. SWFObject is the way to go. I'd like to supplement his answer with a code example. This ought to to get you started: Make sure you have included the swfobject

Memory leak risk in JavaScript closures

对着背影说爱祢 提交于 2019-12-16 20:15:42
问题 Solved There's a lot of contradictory information on the web, regarding this subject. Thanks to @John, I managed to work out that the closures (as used below) aren't the cause of memory leaks, and that -even in IE8- they're not that common as people claim. In fact there was only 1 leak that occurred in my code, which proved not that difficult to fix. From now on, my answer to this question will be: AFAIK, the only time IE8 leaks, is when events are attached/handlers are set on the global

Jquery load() only working in firefox?

冷暖自知 提交于 2019-12-16 20:03:07
问题 I am trying to get into jquery/ajax and I can't even believe I can't get past this first test. I'm following an example I found at The Jquery API site and I followed it just about to a T. I created a local folder on the desktop, and added 2 files. index.html and list1.html. Index.html: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> <div id="stage"> </div> <script> $( "#stage" ).load( "list1.html" ); </script> </body> <

How to focus on JS popups in Firefox & IE?

倾然丶 夕夏残阳落幕 提交于 2019-12-14 03:59:01
问题 I've got a page that must open a popup window on another domain. When the link is clicked on the original page I'd liek it to focus on the new window if it's open, and open it if it's not. This code works in Chrome, but I get nothing for Firefox or IE. var win=null; function pop(){ if(win!== null && !win.closed) { //If it's already open, just focus on it win.focus(); }else { //Otherwise, make a new window and go to it win= window.open("http://google.com"); } }​ Demo here : http://jsfiddle.net

Squeeze a table column to it's minimum possible width

半腔热情 提交于 2019-12-14 03:48:39
问题 Throughout my website, I have many <table> s in which there is a specific column we want to have squeezed to it's minimum possible space (without having it's text wrapped). Other sibling cells share the rest of the space automatically. I'm using the following trick and it works in all browsers except IE7-. (At this time I actually only care about IE7) table {width:100%;} table td.min-col {white-space:nowrap; width:1px; } jsFiddle link: http://jsfiddle.net/vm8gc/23/ If you try this in IE7 you

Crossbrowser brightness filter over img using css

℡╲_俬逩灬. 提交于 2019-12-14 03:42:22
问题 I need to use a full size picture as background and I need that picture to have a brightness filter. Right now it is only working on Chrome and Firefox , the last one using svg. This is what I have: img.fullscreenIMG { display:block; position:absolute; z-index:1; filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' ><filter id='bright30'><feComponentTransfer><feFuncR type='linear' slope='0.30'/><feFuncG type='linear' slope='0.30' /><feFuncB type='linear' slope='0.30' /