Solved

Anchor Tags and IE8

Posted on 2012-03-12
6
635 Views
Last Modified: 2012-04-02
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?
0
Comment
Question by:digitalwise
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37713647
Showing the script you have issues with would be very useful
0
 

Author Comment

by:digitalwise
ID: 37714413
This is all I am using to refresh.

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

Open in new window

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37714441
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:digitalwise
ID: 37714625
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.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 37714753
This should work in IE for sure.

If not, you may have some other issues like not-unique IDs (which IE normally has less of a problem with than Chrome and Fx)

Did you try the onload?

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

Have a look at this article

http://www.zachleat.com/web/domcontentloaded-inconsistencies/
0
 

Author Comment

by:digitalwise
ID: 37725191
This works on the initial click to open the new window but still not on the reload from the page closing...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question