In JavaScript, how can I open a page in a new browser window and scroll to a specific position?

I found something interesting on this...

I've always known you can scroll to an anchor with a name -- in fact, that's the way we were all taught. But I just tried to scroll to a div with an id and it worked!

So, for example, if the target page has a div with id="bobo" then the link http://www.example.com/index.php/home#bobo just worked for me.

Perhaps it's flaky behavior on my end. I feel like I would have heard of this before if it were possible. But all I know is I was trying to do the same thing and for whatever reason it's working.

FWIW, the link I'm using is http://www.religionnews.com/index.php?/rnsblog#blog


If you own both domains, you can use window.postMessage to communicate the scroll position to the other window.
In one page you make the postMessage, and in the other you add an event listener.

If you need to support older browsers, you can use window.name to transfer some data between windows.

If you don't own both domains, you're out of luck, due to the SOP. It is a built-in protection in browsers to avoid cross domain abuses.