Solved

Anchor Tags and IE8

Posted on 2012-03-12
6
589 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
  • 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jQuery value within div undefined 3 22
Menu Inconsistent 3 21
Bootstrap input box width 2 15
How to specify a browser 14 25
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now