0

Is possible to create and download as .html file using jquery/javascript?

If not, is any third party website API available?

Because I planed to create a prototype maker through in blogger.com.

There I can write only client side program.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Merbin Joe
  • 611
  • 6
  • 27

2 Answers2

2

You can try this may help you.

<div id="test">
    <span>testing</span>
</div>

(function(){
    document.location = 
        'data:text/attachment;,' + //here is the trick
        document.getElementById('test').innerHTML;
            //document.documentElement.innerHTML; //To Download Entire Html Source
})();

You can also use html5

<a href="javascript:$('#test').html();" download="Filename">Download Div</a>
Community
  • 1
  • 1
Nikunj Chotaliya
  • 802
  • 8
  • 19
0

Have you tried the $http.get method? That should return a html page (or anything else for that matter). You haven't really said what you want to do with it though...

https://api.jquery.com/jquery.get/

Lee Willis
  • 1,552
  • 9
  • 14
  • I've just re-read your question - creating a HTML file and uploading it to a server isn't going to be possible without some server side code. Getting an existing file will be possible with the get method. – Lee Willis Jul 31 '15 at 09:48