www.webdeveloper.com
Results 1 to 7 of 7

Thread: Is it possible to read a hyperlink from text file w html?

  1. #1
    Join Date
    Nov 2006
    Posts
    2

    Is it possible to read a hyperlink from text file w html?

    Hi
    I want to make a link that reads its location from a .txt file.
    Is that possible in html or do I have to use javascript?
    If you could tell me how to do it in Dreaweaver or give example code that would be Fantastic!

    Thanks in advance
    Dan V

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    HTML won't do it. Javascript might not do it. The best way is to do it on the server as the page is being rendered.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  3. #3
    Join Date
    Nov 2006
    Posts
    104
    ray326 is correct. Best way to do this, is by using some server side language like asp/php etc. html and javascript can't do it.

  4. #4
    Join Date
    Nov 2006
    Posts
    2
    In that case I will probably use flash which does it quite easily.

    Thanks anyway.

    Dan V

  5. #5
    Join Date
    Nov 2006
    Posts
    4
    Quote Originally Posted by mrizwan
    ray326 is correct. Best way to do this, is by using some server side language like asp/php etc. html and javascript can't do it.
    not true. A simple Server Side Include is your simplest solution:
    <!--#include virtual="/pathto/your.txt" -->
    will insert the code in your.txt as html
    you will need to ensure that ssi's are allowed on your server, easiest way is with an .htaccess edit
    http://www.javascriptkit.com/howto/htaccess4.shtml
    http://www-ss.com/tutorials/htaccess/htaccess_04.htm

    I use it extensively on my site:
    Trailers in PA NY OH
    though you won't see it in the source as it is parsed as plain old html in all browsers

  6. #6
    Join Date
    Dec 2012
    Posts
    1
    I have almost the same problem. Iam trying to read from a text file but i want to be able to read the links around my text? i have searched alot and i count find any thing so any help will be appreciated.

  7. #7
    Join Date
    Oct 2012
    Posts
    36
    You could use a javascript AJAX call to read the text file given that:
    a) the text file is on the same server as the website
    b) the text file is accessible via http, i.e. it sits within the website's root directory somewhere.

    The drawback to doing it this way is that anyone who reads the javascript for the AJAX call will then know how to directly access the text file via HTTP, so it's probably not a good idea to put any sensitive/private information in the text file.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles