user3314388
user3314388

Reputation: 21

How to create a link to particular line in text file in html

I created a link in a html file to a text file (logcat.txt). if i open this logcat.txt file via html link, need to open the file and pointed to specific line having keyword("Mylog"). How can i Do it?

Upvotes: 0

Views: 1582

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201588

You cannot link directly to a location inside a plain text file, even in a simple manner like by line number. There is nothing illogical with the idea; there are ways to link to a location in an HTML file, or in a PDF file, using a URL with a fragment identifier at the end (...#foo or ...#page=42 for example). And it would be possible to define a similar mechanism for plain text resources; but no such mechanism has been defined so far, still less implemented.

You might consider writing server-side code that converts the plain text file to an HTML document (possibly rendered with white-space: pre) so that you can link to specific locations there.

Upvotes: 1

Related Questions