我試過可用拖放下載樣本,但問題是它在Chrome中完美的罰款,但是當你試圖拖放文件到本地機器的意圖使用IE下載,它只下載到文件的快捷鏈接。拖拖放下載支持IE瀏覽器的Javascript/jQuery/Html5
任何人都有解決問題的辦法?請分享...
我試着在下面的鏈接中使用代碼。 http://www.thecssninja.com/javascript/gmail-dragout
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-GB">
<head>
\t <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
\t <meta name="author" content="The CSS Ninja">
\t <meta name="keywords" content="Drag and drop, HTML5, DownloadURL, setData, dataTransfer">
\t <meta name="description" content="How to create reverse drag and drop functionality like Gmail in Chrome 5 and upwards">
\t <meta name="robots" content="all">
\t <meta name="copyright" content="The CSS Ninja">
\t
\t <link rel="stylesheet" type="text/css" href="_styles.css" media="screen">
\t
\t <title>Drag a file from a website to your filesystem like Gmail does | The CSS Ninja</title>
</head>
<body>
\t
\t <div class="container">
\t \t <h1>Drag out any of these links to your dekstop</h1>
\t \t
\t \t <a href="Eadui.ttf" id="dragout" class="dragme" draggable="true" data-downloadurl="application/octet-stream:Eadui2.ttf:http://thecssninja.come/demo/gmail_dragout/Eadui.ttf">Font file</a>
\t \t
\t \t <a href="Eadui.ttf" id="dragout2" class="dragme" draggable="true" data-downloadurl="application/pdf:HTML5CheatSheet.pdf:http://thecssninja.come/demo/gmail_dragout/html5-cheat-sheet.pdf">PDF file</a>
\t </div>
\t
\t <script type="text/javascript">
\t \t var files = [document.getElementById("dragout"),document.getElementById("dragout2"),document.getElementById("dragout3")],
\t \t \t fileDetails = [];
\t \t
\t \t // Some forward thinking, utilise the custom data attribute to extend attributes available.
\t \t if(typeof files[0].dataset === "undefined") {
\t \t \t // Grab it the old way
\t \t \t fileDetails[0] = files[0].getAttribute("data-downloadurl");
\t \t \t fileDetails[1] = files[1].getAttribute("data-downloadurl");
\t \t } else {
\t \t \t fileDetails[0] = files[0].dataset.downloadurl;
\t \t \t fileDetails[1] = files[1].dataset.downloadurl;
\t \t }
\t \t
\t \t files[0].addEventListener("dragstart",function(evt){
\t \t \t evt.dataTransfer.setData("DownloadURL",fileDetails[0]);
\t \t },false);
\t \t files[1].addEventListener("dragstart",function(evt){
\t \t \t evt.dataTransfer.setData("DownloadURL",fileDetails[1]);
\t \t },false);
\t </script>
\t
</body>
</html>
你可以包括'html','javascript'試過了嗎? – guest271314
請參考我用代碼示例修改它的原始問題。 – Dspinx