Jump to content

How to return focus to parent page from child page with an anchor?


Recommended Posts

I've been pulling my hair out with this one.

 

I have a page with an iframe with an anchor.

 

Main frame - myTasksIframe.php

<iframe src="myTasksIframe.php?PID=1234&testPID=5678#iframeAnchor=$iframeAnchor">

 

When I click on a link in the iframe:

 

Iframe = myTasksIframe.php

<a href="myTask.php?testPID=$testPID&iframeAnchor\" target=\"_parent\">Go to place in iframe</a>

 

it will refresh the main page, and skip down to the anchor in the iframe.

 

Trouble is that the page focus goes to the iframe, and the page is shifted down and I can't figure out how to make the anchor happen while setting the main page to NOT focus on the iframe and shift the page down.

 

I've tried many versions of

 

window.scrollTo(0,0);
parent.window.scrollTo(0,0);
opener.window.scrollTo(0,0);
opener.scrollTo(0,0);
parent.window.location = "#"

 

and so on. I can't get any of it to work. Please HELP!

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.