0

This is driving me crazy but is there a way to read a local text file from my computer and have it display the text from the text file to the page.

I've tried:

<iframe src="test.txt" frameborder="0" style="color: white;"></iframe>

However, you can't change the text color and I assume you can't change the font-family. Is this any way possible?

EDIT: I'm trying to make an overlay on OBS where the HUD fades away and comes back, however, there are several texts located in text files that I need to use since they change, for example, last follower. The name of the follower gets added to the text file in which I was hoping I can display and modify the font color and family to fit the theme of the HUD. I only plan on using the html page locally through browser source.

Noxavi
  • 13
  • 1
  • 3
  • 2
    Possible duplicate of [making a paragraph in html contain a text from a file](https://stackoverflow.com/questions/6348207/making-a-paragraph-in-html-contain-a-text-from-a-file) – caramba Oct 26 '17 at 05:31
  • where is the top page served from? if http, then no. also, you need to use js to reach into the iframe's DOM to inject CSS that changes the color. however, for a plain-text document, the DOM might not be what you expect, or anything at all... – dandavis Oct 26 '17 at 05:34

1 Answers1

0

Take a look at this Javascript plugin, it can help:

https://github.com/systemjs/plugin-text

this plugin gets the text and stores in a variable, so you can use this variable to replace some innerHTML of an element, like a >p<, >div<, etc...

Or, you can use the simplest way, jQuery .load() function:

http://api.jquery.com/load/

Calvin Nunes
  • 6,376
  • 4
  • 20
  • 48