Monday, 15 July 2013

Loading plain text files in html/Javascript without httpxmlrequest -



Loading plain text files in html/Javascript without httpxmlrequest -

the question bit theoretical. suppose have local image file loaded 1 time in html , used in script. write 1 line:<img id="myimage" src="myimage.png"/>

now suppose want same text. have local .txt file. seems overdo create http request such simple purpose! using script var = "my text here" seems dirty solution, besides text should edited in case.

is there way simplify that? , if not there architectural explanation?

you can utilize iframe :

<iframe src="file.txt"></iframe>

javascript html xmlhttprequest plaintext

No comments:

Post a Comment