Skip to content

Instantly share code, notes, and snippets.

@ZacharyJacobCollins
Created January 19, 2016 03:24
Show Gist options
  • Save ZacharyJacobCollins/b476f461d0c753c8c1ee to your computer and use it in GitHub Desktop.
Save ZacharyJacobCollins/b476f461d0c753c8c1ee to your computer and use it in GitHub Desktop.
Get text as text file from url - js - anchor method
<!DOCTYPE html>
<html>
<head>
<title>text getter</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<h3>click the button to get text file in both json and text format</h3>
<p>url : http://it.emich.edu/bannerfiles/sctnenrl_wi.txt</p>
<a onclick="http://it.emich.edu/bannerfiles/sctnenrl_wi.txt='data:text;charset=utf-8,'+encodeuricomponent(document.documentelement.outerhtml)" href="http://it.emich.edu/bannerfiles/sctnenrl_wi.txt" download="page.txt">download</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment