I am generating some important information on the HTML page at the end of a transaction.
<html>
<head>
  <script type="text/javascript">
    function downloadReference(){
    }
  </script>
</head>
<body>
  <p>
  Hello! Thank you for your interest.
  </p>
  <table style="background-color:#ccffcc;border: 1px solid #00cc00" id="referencedata">
    <tr>
        <td><b>Interest Received Date:</b></td>
        <td>22 March 2018</td>
    </tr>
    <tr>
        <td><b>Confirmation Number:</b></td>
        <td>J4835K3344</td>
    </tr>
  </table>
  <br/>
  <a href="#" onclick="return downloadReference();" download="Reference.html">Download this info!</a>
</body>
</html>
Now, I want give user an option to download this info for his reference. I don't want to create a file at server side.
I know in HTML5 we can give download attribute in anchor tag to allow user to download the file, but how do I generate the content on the fly and not refer to any physical file?
 
    