cross-browser

javascript to find memory available

扶醉桌前 提交于 2019-12-18 04:52:41
问题 Let's make it immediately clear: this is not a question about memory leak! I have a page which allows the user to enter some data and a JavaScript to handle this data and produce a result. The JavaScript produces incremental outputs on a DIV, something like this: (function() { var newdiv = document.createElement("div"); newdiv.innerHTML = produceAnswer(); result.appendChild(newdiv); if (done) { return; } else { setTimeout(arguments.callee, 0); } })(); Under certain circumstances the

What do browsers want for the Content-Type header on json ajax responses?

若如初见. 提交于 2019-12-18 04:14:56
问题 I am returning some json which needs to be handled by javascript as the response to an XMLHTTPRequest. If I set the response's content type to "text/plain", all browsers but Chrome will accept it and pass it to my JS with no problem. However, Chrome will wrap the response in <pre style="word-wrap: break-word; white-space: pre-wrap;"> before passing it to my javascript. If I set the response's content type to the "proper" "application/json" all browsers but Firefox will accept it and pass it

Testing for multiple screens with javascript

為{幸葍}努か 提交于 2019-12-18 04:14:07
问题 Is it possible to tell if the user of a website is using multiple monitors? I need to find the position of a popup but it's quite likely the user will have a multiple monitor setup. Whilst window.screenX etc. will give the position of the browser window it's useless for multiple monitors. 回答1: I do not believe that it is possible right now; however js is becoming more popular for desktop use in widgets in addition to web development and that would be an excellent feature to request for a

Fine Grained rest HTTP verbs browser support

假如想象 提交于 2019-12-18 03:32:22
问题 Is there any data regarding how browsers actually support rest http verbs (especially PUT, DELETE). This question is mostly motivated by the fact that many sources (such as this stackoverflow answer) inform that most browsers don't suport PUT and DELETE but don't say which. Rails solves this using a patch on the client, and reversing the patch on the server, but I wonder, for instance, which browsers wouldn't need such hack. 回答1: When in doubt, ask Anne: http://annevankesteren.nl/2007/10/http

How to determine the Opera browser using JavaScript

梦想的初衷 提交于 2019-12-18 03:12:21
问题 I want to determine that the browser of the client machines in Opera or not using JavaScript, how to do that? 回答1: The navigator object contains all the info you need. This should do: navigator.userAgent.indexOf("Opera"); 回答2: Now that Opera uses the Chrome rendering engine, the accepted solution no longer works. The User Agent string shows up like this: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.132

How to determine the Opera browser using JavaScript

岁酱吖の 提交于 2019-12-18 03:12:19
问题 I want to determine that the browser of the client machines in Opera or not using JavaScript, how to do that? 回答1: The navigator object contains all the info you need. This should do: navigator.userAgent.indexOf("Opera"); 回答2: Now that Opera uses the Chrome rendering engine, the accepted solution no longer works. The User Agent string shows up like this: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.132

Safari ignoring/removing anchors (or “hashtags”) when clicking hyperlinks?

左心房为你撑大大i 提交于 2019-12-18 03:09:17
问题 I need to point one page to another and then scroll to a particular section. In Chrome and Firefox, using an URL like www.example.com#section1 does the trick. (#section1 can be an anchor or an element's id). However, in Safari, the hash disappears when I click the link. Why is this happening? Is it possible to do it on Safari? If not, how can I get around this problem? 回答1: When using hyperlinks that point to inside sections on other pages you must remember to add a slash (/) before the

Diagonal Gradient in IE

雨燕双飞 提交于 2019-12-17 22:43:09
问题 Is there a way to have a diagonal gradient in IE? In Chrome I could do something like this: body{ background-image:-webkit-gradient( linear, left top, right bottom, color-stop(0%,#f00), color-stop(50%,#0f0), color-stop(100%,#00f)); } but this doesn't work in IE. 回答1: Yes, it is possible! Although it does not work as well as a real diagonal gradient in other browswers. There are two important aspects of this solution that make it work: Two divs with the same position and different z-index

Are there any JavaScript library for cross browser desktop notification?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 22:29:15
问题 I know W3C just publish their draft version of Web Notification to notify user. So, there is no browser that implement this method in their current or latest build browser. Web Notifications Overview After I search a lot of webs for finding all possible desktop notification in most browser.I found any 2 major browser that should support this. 1. Google Chrome and Webkit-based browser (source: google.com) (source: google.com) (source: google.com) We can use native Desktop notification function

How to position a div in bottom right corner of a browser?

不羁的心 提交于 2019-12-17 22:11:47
问题 I am trying to place my div with some notes in the bottom right position of the screen which will be displayed all time. I used following css for it: #foo { position: fixed; bottom: 0; right: 0; } It works fine with Chrome 3 and Firefox 3.6 but IE8 sucks... what can be a suitable solution for it? 回答1: This snippet works in IE7 at least <!DOCTYPE html> <html> <head> <meta charset=utf-8 /> <title>Test</title> <style> #foo { position: fixed; bottom: 0; right: 0; } </style> </head> <body> <div id