EN
此内容没有您的语言版本,但有英语版本。

MSBlobBuilder object

The MSBlobBuilder constructor returns an MSBlobBuilder object.

Syntax


var MSBlobBuilderObject = new MSBlobBuilder();

DOM Information

Inheritance Hierarchy

The MSBlobBuilder does not inherit from any class or interface.

Members

The MSBlobBuilder object has these types of members:

Methods

The MSBlobBuilder object has these methods.

MethodDescription
append

Appends the supplied Blob to the current contents of the MSBlobBuilder object.

getBlob

Returns the Blob object for a given MSBlobBuilder object.

 

Remarks

Use the Blob constructor instead of the MSBlobBuilder constructor.

Examples


<!DOCTYPE html>
<html>

<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>Blob vs. MSBlobBuilder</title>
</head>

<body>
  <p>This text should be red.</p>
	<script>
	  var myBlob;
	  
    window.URL = window.URL || window.webkitURL;
    	  
	  if (window.Blob) {
      myBlob = new Blob(['body { color: red; }'], {type: 'text/css'});  
      appendLinkElement();
      console.log("The Blob() constructor was used.");    
	  } 
	  else if (window.MSBlobBuilder) {
      var myBlobBuilder = new MSBlobBuilder();
      myBlobBuilder.append('body { color: red; }');
      myBlob = myBlobBuilder.getBlob('text/css');
      appendLinkElement();
      console.log("The MSBlobBuilder() constructor was used.");      
	  } 
	  else {
	    document.getElementsByTagName('body')[0].innerHTML = "<h3>Blob objects not supported - please upgrade your browser.</h3>";
	  }
    
    function appendLinkElement() {
      var link = document.createElement('link');
      
      link.rel = 'stylesheet';
      link.href = window.URL.createObjectURL(myBlob);
      document.body.appendChild(link);    
    } // appendLinkElement
	</script>
</body>

</html>


 

 

显示:
© 2014 Microsoft