Avatar of digitalwise
digitalwise
 asked on

Anchor Tags and IE8

I have a page that has anchor tags.   A user clicks on a link that pops up a new window to add notes to the option for a presenation.   Once they are done adding notes, the pop-up window has a javascript to refresh the parent page to show that notes have been added to that slide.    The list of options on the parent page is fairly long so the desire is to have the refresh return to the anchor/slide that was just modified so that the user doesn't have to scroll back down.    This works just fine in Firefox and Chrome but doesn't in IE.    It refreshes the page but doesn't go to the anchor.   I have seen some comments that IE just gives up right away if the anchor is written yet so I imagine that is my problem.    Does anyone have a solution to this?
Web BrowsersHTML

Avatar of undefined
Last Comment
digitalwise

8/22/2022 - Mon
Michel Plungjan

Showing the script you have issues with would be very useful
digitalwise

ASKER
This is all I am using to refresh.

 <SCRIPT Language="JavaScript">
opener.location.reload();
self.close();
</SCRIPT>

Open in new window

Michel Plungjan

So you need to send the anchor to the popup so it can do

opener.location="whateverurl.com/page.html#anchor"

instead OR save the anchor in a cookie and do

window.onload=function() {
  var anc = getCookie('currentAnchor');
  if (anc && document.getElementById(anc)) {
    document.getElementById(anc).scrollIntoView()
  }
}

I am using ID instead of name="#somename" here. All modern browsers will allow ID instead
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
digitalwise

ASKER
We are using ID as well.   However it still isn't working.  I tried both of your solutions which work great.   But IE just doesn't appear to care.   It appears that IE just doesn't wait for the page to load all of the way and it stops looking for the id when it isn't readily available.   Firefox and Chrome don't have any issues.
ASKER CERTIFIED SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
digitalwise

ASKER
This works on the initial click to open the new window but still not on the reload from the page closing...