1.ie6:
- var file_url = document.getElementById("file").value;
var file_url = document.getElementById("file").value;
2.ie7/ie8:
- var file = document.getElementById("file");
- file.select();
- var file_url = document.selection.createRange().text;
var file = document.getElementById("file"); file.select(); var file_url = document.selection.createRange().text;
3.firefox3.0
- var file_url = document.getElementById("file").files[0].getAsDataURL();
转自http://www.iteye.com/topic/574552
function getBrowser() {
$sys = $_SERVER['HTTP_USER_AGENT'];
if (stripos($sys, "NetCaptor") > 0)
$exp = "NetCaptor";
elseif (stripos($sys, "Firefox/") > 0) {
preg_match("/Firefox\/([^;)]+)+/i", $sys, $b);
$exp = "Firefox" . $b[1];
} elseif (stripos($sys, "MAXTHON") > 0) {
preg_match("/MAXTHON\s+([^;)]+)+/i", $sys, $b);
preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie);
$exp = $b[0] . " (IE" . $ie[1] . ")";
} elseif (stripos($sys, "MSIE") > 0) {
preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie);
$exp = "IE" . $ie[1];
} elseif (stripos($sys, "Netscape") > 0)
$exp = "Netscape";
elseif (stripos($sys, "Opera") > 0)
$exp = "Opera";
else
$exp = "未知浏览器";
return $exp;
}
http://hi.baidu.com/xilucao/blog/item/e876239b521b6cb9c9eaf40b.html