Depends on the situation:
1- Your own content
a. Just add the href id and then send a link to it ( http://exmaple.com/document.php#myLine )
b. . For a more advanced solution, you can go to a specific area and select it using javascript, basically you call something like this: http://example.com/document.php?scrollX=100&scrollY=230
and in your PHP code you have this function:
<?php if(isset($_GET['scrollX']) && isset($_GET['scrollY')){ ?> <script type="text/javascript"> window.scrollTo(<?= $_GET['scrollX'];?>, <?=$_GET['scrollY'];?>); </script> <? } ?>
You can also use jQuery and do more interesting things like highlighting text or changing CSS values depending on the arguments
2-specific content
You cannot directly link to a specific line or region without extending the browser or an external service, for example CiteBite , however with some hackers you can create your own small service that displays the website and runs its own JS on it (I think, iFrames or something something like that)
source share