您的位置:首页 > 编程语言 > Go语言

ie6/7/8 FireFox Google 浏览器问题参考

2012-04-20 11:53 141 查看
/content/3505715.html

/article/6088233.html

http://zhidao.baidu.com/question/223390215.html
http://www.iefans.net/ie-shangchuan-bendi-lujing-fakepath/
http://www.yunsec.net/a/Special/wzjs/wzbc/aspx/2010/1201/7240_2.html

//火狐浏览器读取url

function readFileFirefox(fileBrowser) {

try {

netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

}

catch (e) {

alert("需要设置一下浏览器才能使用,在URL地址栏中输入about:config打开,进入浏览器参数配置,找到"signed.applets.codebase_principal_support",将它的值切换为true;如果找不到"signed.applets.codebase_principal_support",则右键 新建 > 布尔 > 输入变量'signed.applets.codebase_principal_support' , 刷新浏览器重试!");

//alert('Unable to access local files due to browser security settings. To overcome this, follow these steps: (1) Enter "about:config" in the URL field; (2) Right click and select New->Boolean; (3) Enter "signed.applets.codebase_principal_support" (without the quotes) as a new preference name; (4) Click OK and try loading the file again.');

return;

}

var fileName=fileBrowser.value;

var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);

try {

// Back slashes for windows

file.initWithPath( fileName.replace(/\//g, "\\\\") );

}

catch(e) {

if (e.result!=Components.results.NS_ERROR_FILE_UNRECOGNIZED_PATH) throw e;

alert("File '" + fileName + "' cannot be loaded: relative paths are not allowed. Please provide an absolute path to this file.");

return;

}

if ( file.exists() == false ) {

alert("File '" + fileName + "' not found.");

return;

}

return file.path;

//alert(file.path); // I test to get the local file's path.

/* var is = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance( Components.interfaces.nsIFileInputStream );

try {

is.init( file,0x01, 00004, null);

}

catch (e) {

if (e.result!=Components.results.NS_ERROR_FILE_ACCESS_DENIED) throw e;

alert("Unable to access local file '" + fileName + "' because of file permissions. Make sure the file and/or parent directories are readable.");

return;

}

var sis = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance( Components.interfaces.nsIScriptableInputStream );

sis.init( is );

var data = sis.read( sis.available());

*/

//alert("Data from file: " + data); // I test to get the local file's data.

}

//更改文件URL

function updatePath(){

var $file = $('#exprot_youfei_list1');

var $file2 = $('#exprot_youfei_list2');

$file2.val($file.val());

//alert(navigator.userAgent);

//var file = document.getElementById('exprot_youfei_list1');

//var file2 = document.getElementById('exprot_youfei_list2');

//var show = document.getElementById('showurl');

////IE 直接给值

//if (navigator.userAgent.indexOf("MSIE")!=-1) {

//

//var bb = navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE"),8);

//alert(bb);

//

//file2.value = file.value;

//show.innerHTML = file.value;

//if(bb == "MSIE 8.0" || bb == "MSIE 9.0"){

////>IE7

////alert(">7");

//file.select();

//try{

// var va = document.selection.createRange().text;

// alert("va="+va);

// show.innerHTML = va;

// file2.value = va;

//}catch(e){

//alert("error"+e);

//}finally{

//document.selection.empty();

//}

//}

//

// } else if (navigator.userAgent.indexOf("Firefox")!=-1){

//

// file2.value = readFileFirefox(file);

// show.innerHTML = file2.value;

// } else if( navigator.userAgent.indexOf("Chrome")!=-1){

//alert("不兼容此浏览器,URL错误");

// try{

// var s = file.value;//files.getAsDataURL();

// file2.value = s;

// show.innerHTML = s;

// }catch(e){

// alert("异常"+e);

// }

// }else{

//

// }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: