Navigate to anchor in already open page

For my ASP net application, I would like to have a browser tab or window open for help. Within the main application  I would like to be able to press one of many buttons and have focus go to specific anchor points with in the "help window.  And if the help window is not open then I need to be able to have it open first.

I'm comfortable creating the JavaScript that would be needed to specify which anchor point to go to depending on context information and the button pressed.

However I'm not clear on the syntax of the window statements that would be needed to do this.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gurvinder Pal SinghCommented:
Not sure if I have understood the question clearly.
But it appears that you are looking for these

Example 1
Example 2
Hans LangerCommented:
You could try something like:
function showHelp(itemId){
   if( ='help.html') = itemId

Open in new window

The "help.html" page need to by inside the domain of the parent page to be able to change the location attribute
Julian HansenCommented:
Define your target points in the help file with id's

<div id="section1"> ...</div>
<div id="section2"> ... </div>

Open in new window

Then open the window with the url help.html#section1 (or whatever section you want to go to
<!doctype html>
<script type="text/javascript">
window.onload = function () {'help.html#section2', 'helpwindow')

Open in new window

Help file
<div id="section1">Section 1 copy goes here</div>
<div id="section2">Section 1 copy goes here</div>
<div id="section3">Section 1 copy goes here</div>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

codequestAuthor Commented:
Thanks to all for your inputs.   I implemented this, to try both examples:

function OpenHelp(varHelp) {
    var ws = "TestHelp.aspx"
    switch (varHelp) {
        case 1:
            ws += "#section1"  // does the rest below
        case 2:
            ws += "#section2"  // does the rest below

        case 3:
            if (window.win2 == null) {
                window.win2 ='TestHelp.aspx')
            else {
                window.win2 = window.focus("TestHelp.aspx")
            window.win2.location.hash = "section3"

    }, 'helpwindow')

Open in new window

@julianH:  your example works pretty much as is, useful, thanks.  
One followup:  In Chrome, your construct both opens the help window and moves the focus to it.  In IE11, on the first use it opens the help window and moves focus to it, however, on the second use it just makes the help window tab blink.   Is there a way to make IE actually go to the help window instead of just making the tab blink?

@GERENTE:  yours is intriguing, however, there are some things I don't understand:
I (naively) rewrote your example as shown above.  (I thought it would need the "else" in order to set the value of "win2").   Things I don't understand:

1) What is the mechanism of "window.win2 = "  (or .win)?  It seems to be creating a window object for later use, however, I can't find any documentation on how that works.  
2)  As you can see, for the "else" condition I tried (again, naively)
window.win2 = window.focus("TestHelp.aspx")  

Open in new window

however that doesn't work to set the win2 object because it is "nothing" when it hit the hash statement.   What's the correct way to set the win2 object (if that's what it's doing) when the window is already open?
Julian HansenCommented:
You can try the .focus() method

var helpwindow =, 'helpwindow);

Open in new window

Not handled the same by all browsers - does not work in FF - FF will open the window if not there otherwise it will shift the content to the right place but won't switch to the window.
Hans LangerCommented:
"window" is the root object of you page, so " =" means you will define a variable at global scope, its the same than just use "win =", it will assume that "win" belong to "window" for omition.
So, with a global variable you can access to it from any javascript function or context. will return the "new window object" and it will assign it to "", so then you can work "" as a window variable. You only can modify it if the "" path its in the same domain as you main page.

If you want to focus the new page you can try with "" because "" its a window object, but im not sure if it is crossbrowsing.

If you are using chrome, after open the new window you can type "" in the console and you will see all its properties.
codequestAuthor Commented:
Thanks for inputs; "got it" on the variable.  I'll test and post back on the "focus" soon.
codequestAuthor Commented:
I used this.  It forced a new whole browser window, which is better in this instance, and does shift focus to it.

function RspHelp(varAnchor) {
    var winHelp
    var wrkHelpUrl = ""
    wrkHelpUrl = '/../App_Pages/fA50_HELP/fA50_HELP.aspx'
    var ws = wrkHelpUrl + "#" + varAnchor
    winHelp =, 'helppage', 'toolbar=1,location=0,menubar=1')
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.