| It's possible - but only if you also have access to the destination website and are allowed to edit the code there (or the owner is willing to do it) |
Yes, it's possible, but you do not need access to the webpage's code to edit it.
You also don't need permission to link to anyone's webpage, unless you're doing it for nefarious reasons. If it's just a reference, that's allowable.
The problem is knowing how the webpage was coded and what and where the ID is for the region you want to link to. That is, IF there is an ID for it on the page.
Most webpages today define regions of the page with IDs that can be on various elements of a webpage, such as DIV, H1, and other heading tags. But older websites or those designed by amateurs might not have the IDs for you to link to.
How to:
View the sourcecode of the webpage in your browser. This is usually accessed from the options or controls for your particular browser.
All webpages begin with a <HEAD> section. Skip over it to the <BODY> section where all the content is contained.
Scroll down to the area you want to link to (this might be hundreds of lines down). See if the area has id="something" just before the area or at the beginning of the line of text. That's the ID.
Example:
For a fictitious website called www.OurCompany.com, it could look like this:
<H1>Welcome to our company</H1>
<P>Blady blah blah blah.</P>
<H2 id="aboutus">About our company</H2>
<P>We are great.</P>
See if you can spot an id="x" somewhere. It might also be on a DIV tag, <DIV id="productssection">
Take the words between the quote marks and put that into InDesign's hyperlink section. In this example it would look like:
http://www.ourcompany.com#aboutus
Note the hashtag # between the real URL and the ID portion. No spaces, no punctuation.
Good luck.
Understand that the website's owner can always change their code so this link might become out of date in the future.