Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>HTML5 Blob URL應用-XHR網址來源</title>
    <style>
    </style>
</head>
<body>
    <div>
      <input type="file" id="fileSelector" />
      <br />
      URL: <input type="text" id="txtUrl" style="width: 60%"/>
      <br />
      <input type="button" id='btnReadFile' value='XHR讀取檔案' />
      <br />
      <textarea id="taDisplay" style="width: 80%; height: 50px;"></textarea>
  </div>
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.js "></script>
<script>
        $(function () {
          var $link = $("#aDownload");
          $("#fileSelector").change(function(e) {
              var file = e.target.files[0];
              $("#txtUrl").val(URL.createObjectURL(file));
          });
          
          $('#btnReadFile').click(function() {
            $.get($("#txtUrl").val(), function(res) {
              $("#taDisplay").text(res);
            }, "text");
          });
        });
    </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
darkthreadpro
0viewers