简体   繁体   中英

Javascript - web chat variant. Import of txt log on connection for newly connected user

As in the title - i'm looking for/thinking of a javascript code that would import last few lines of a txt file without certain signs (print the last few messages logged on server) - then print them on the chat window that is present on the site, but only for the user that has just connected - something like a flash-back of last few messages for new user to know what was the subject of last talk.

Found nothing that hit the spot, something with XMLHttpRequest and something with FileReader, yet too low on actual JS skill to extract most valuable info. Tried to write something but it ended as a piece of junk.

Any ideas ?

Javascript no support Read or Write into a file. You can use Server-Sent Events: http://www.w3schools.com/html/html5_serversentevents.asp then Write log with Server Side Language

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