DNA Download Demo: JavaScript
Direct link to content on an origin server
Link to same content with DNA acceleration (if DNA is not detected it will download from the origin server)
<!-- BITTORRENT DNA INTEGRATION -->
<!-- THIS IS AN EXAMPLE OF USING DNA TO ACCELERATE A CONTENT URL WHICH IS SET UP TO BE PASSED TO A BROWSER DOWNLOAD MANAGER TO DOWNLOAD THE CONTENT -->
<!-- IN THIS CASE THE BTDNA JAVASCRIPT IS USED TO REWRITE THE CONTENT URL TO USE DNA WHEN DNA IS AVAILABLE -->
<!-- AN ADDITIONAL SIMPLE 2-LINE JAVASCRIPT IS USED TO CREATE THE LINK ON THE PAGE THAT CAN BE CLICKED-->
<html>
<head>
<script type="text/javascript" src="http://btdna.bittorrent.com/btdna.js"></script>
</head>
<body>
<br />
<a href="http://download.bittorrent.com/dl/BitTorrent-4.27.2.dmg"> Direct link to content on an origin server</a>
<br />
<br />
<a id="contenturl" href="http://download.bittorrent.com/dl/BitTorrent-4.27.2.dmg"> Link to same content with DNA acceleration (if DNA is not detected it will download from the origin server) </a>
<!-- SIMPLE SCRIPT TO DNA-ACCELERATE A URL VIA DNA JAVASCRIPT API -->
<!-- THE DNA JAVASCRIPT API WILL ONLY REWRITE A URL IF IT DETECTS DNA ON THE MACHINE IN QUESTION -->
<!-- THIS IS USEFUL IN CASES WHERE IT CANNOT BE GUARANTEED THAT 100% OF END USERS WILL ALREADY HAVE DNA INSTALLED -->
<script type="text/javascript">
var contenturl = document.getElementById('contenturl');
contenturl.href = btdna({url:contenturl.href, qos:100000, service:'min_rate_data'});
</script>
<br />
<br />
<!-- SIMPLE SCRIPT TO DNA-ACCELERATE A URL DIRECTLY USING DNA PROXY API -->
<!-- THIS DEMONSTRATES THE SIMPLE CALL TO DNA SPECIFYING THE CONTENT URL, THE SERVICE AND THE QOS -->
<!-- THE ONLY REASON A SCRIPT IS USED HERE IS TO ALLOW FOR AUTO-DETECTION OF THE DNA PORT USING THE FUNCTION btdna_port() -->
<!--THIS TYPE OF INTEGRATION IS REALLY ONLY RECOMMENDED IN CASES WHERE IT IS GUARANTEED THAT 100% OF END USERS WILL ALREADY HAVE DNA INSTALLED -->
<script type="text/javascript">
document.write("<a href=\"http\://127.0.0.1:" + btdna_port() + "/proxy?qos=100000&url=http://download.bittorrent.com/dl/BitTorrent-4.27.2.dmg&service=min_rate_data\"> Link to same content directly accessing DNA acceleration (if DNA is not detected this method will fail) </a>")
</script>
</body>
</html>
<!-- Dynamic Page Served (once) in 0.146 seconds -->
