Herbert37 has asked for the wisdom of the Perl Monks concerning the following question:

How can I use CGI to create a clickable link to specific text in a web page that is not referenced by any tag?

The equivalent manual action would be to go to the web page/link and hit Command F, enter the text to be searched for in the search box, and hit Return.

Thank you in advance for any help you can provide!

Replies are listed 'Best First'.
Re: CGI link to naked text
by Corion (Patriarch) on Mar 04, 2015 at 12:22 UTC

    This has nothing to do with CGI or Perl, and seems to me to only relate to HTML and hyperlinking.

    To my knowledge, neither HTML or the URIs used by HTML allow you to create a link to something that does not have a <a name="foo"> anchor to it. You can link to the top of a page by not using an URI anchor and you can link to a named part of the page by using the name of the respective anchor, but further granularity is not possible.

    If you want to show highlighted or annotated parts of a webpage, your program will need to create a link to itself and then at display time, download the real page and serve up a highlighted version of it.

Re: CGI link to naked text
by hippo (Archbishop) on Mar 04, 2015 at 12:22 UTC
      This requires access to the domain of the target.

      Either to include the script directly or to create a frame set which has no conflict with "same origin policy".

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      PS: Je suis Charlie!

      Your answer is the correct and particularly helpful one. Thank you.

      I should have phrased it differently.

Re: CGI link to naked text
by Herbert37 (Novice) on Mar 04, 2015 at 13:51 UTC

    I feared that the answer would be what the answers are. Please forgive my wasting your time.