Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    Changing font in iFrame

    Okay so I'm trying to get my website to read this text document using iframes, which is working well except that the font is annoyingly notepad-esque (I don't know the exact font name, but one can tell that it is a text document rather than word). I'd prefer it if I was able to view the document in a different font. Is there any way to do this with iframes?
    Basic code (ignoring all other aspects) so far:
    <iframe ref="comments.txt"></iframe>
    Where comments.txt is the text file I'm trying to get on the webpage. I can't just write the info on the webpage because the whole point of this is to have a document without html coding on it that can be edited which the website will then take as an update. This will make life a lot easier for those people who will be updating the site and are not familiar with html coding.
    I hope that explains the problem...

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Dundee, Scotland
    Thanked 39 Times in 39 Posts
    Because the file is a ".txt" file there will be no way of defining fonts in it. There is no DOM in a plain text file so nothing for the browser to "get hold of".

    You could try loading the file into a variable, prepend and append the appropriate html code to it and add in some font code, then make the source of the iframe equal to the content of the variable.
    Regards, Stooshie


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts