Make changes to a website written in HTML based on the content on a text file


New Member
So I've been looking around for an answer to this, without success.
So I'm looking to have the text inside of a .txt file to be inserted in a line in html5 code, I can't think of how this should be worded so here's an example.

<iframe type="text/html" frameborder="0" width="1920" height="1080" src="" allowfullscreen></iframe>
And is it possible to have it change every time the content of the text file changes?
Any questions please reply I'm sure I wrote this somewhat wrong.


Thành viên BQT
Your IFrame's src should simply be set to the full url to the text file. In your example, replace 'TEXTFILECONTENT' with the file name, like 'MyTextFile.txt'. Then the browser should fetch the file and display it in the iframe. If your textfile is in a subdirectory, then add that to the url, like 'folder/textfile.txt'.
Edit: You can add a link to your page that loads the textfile into the iframe. First give your iframe an id, like this:
<iframe id="myiframe" type="text/html" frameborder="0" width="1920" height="1080" src="" allowfullscreen></iframe>
Then give your link a target attribute, like this:
<a href="discordinvite.txt" target="myiframe">Discord server</a>
Now when people click the link the textfile will be loaded into the iframe.


New Member
Thank you for that, I'm looking to also format it to this <a href="discordinvite.txt">Discord server</a> sort of, I tried different ways but none of them worked so I'm back here asking. Thanks!

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.