简体   繁体   中英

How to display content of a file on web

Hi I am new to web development and looking for a way to display content of a file on a web page. Currently I am able to load the content of a text file and show the same in a huge text box. I need to display the content of more types of files like xml or PDF or Excel or infact any types of file. Is there a tag or a plug-in I can use to do so? Also, is there a way I can display content of two documents side by side and provide diff sort of functionality.

You can try this

 var xhr = new XMLHttpRequest;
    xhr.open('GET', 'file.txt', true);
    xhr.onload = function (){
        document.write( xhr.responseText );
    };
    xhr.send(null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM