EpsilonVector
EpsilonVector

Reputation: 4043

Is there a way to link to the middle of someone else's page even if they don't have an anchor?

...something along the lines of telling the browser which percent of the page to center to?

Upvotes: 7

Views: 5381

Answers (3)

MCH
MCH

Reputation: 480

{using Google Chrome web browser; remeber wiki is dynamic and the following URL may get invalid at anytime, the process is still valid though!}

1_ This is the main URL:

https://en.wikipedia.org/wiki/RSA_(cryptosystem)

2_ I want to refer to "A worked example" in the middle of the page

3_ right click on "A worked example" -> Inspect Element -> Edit as HTML

4_ you should see this:

<span class="mw-headline" id="A_worked_example">A worked example</span>

5_ The id is id="A_worked_example". Copy-paste it in the following sentence as follows:

<a href="http://somePage.com#someId">Middle!</a> :

<a href="https://en.wikipedia.org/wiki/RSA_(cryptosystem)#A_worked_example">Middle!</a>

6_ There you go:

https://en.wikipedia.org/wiki/RSA_(cryptosystem)#A_worked_example

:)

Upvotes: 0

TNC
TNC

Reputation: 5386

No, you can't do this without anchors. You would need to access the DOM in order to do a scrollTo or something like that, which is prohibited on different domains. Security being the main reason.

Upvotes: 0

Matthew Manela
Matthew Manela

Reputation: 16752

Yes you can. If the person has an element with an ID anywhere on the page. For example:

<div id="someId"></div>

Then you can create a link to this page like:

<a href="http://somePage.com#someId">Middle!</a>

The only thing you need to do is choose an Id in the middle.

Upvotes: 12

Related Questions