Solved

Javascript window.location.hash IE problems

Posted on 2008-06-25
3
7,578 Views
Last Modified: 2013-12-08
Alright this peice of code

<script type="text/javascript">
      window.location.hash = '#' + document.cookie;
      alert(document.cookie);
</script>

Works perfect with FF but when I run it in IE it almost shows me the alert window.location.hash does not work with my IE7 any reasons why? Any workarounds? And yes alert gives me the value its suppose to so I know the cookie peice is working.

Thanks
0
Comment
Question by:aumudin
[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
  • 2
3 Comments
 
LVL 4

Author Comment

by:aumudin
ID: 21868067
made some progress...

im using jquery / thickbox iframe modal. So the problem is when in IE window.location.hash tries to use it on the parent window.

Im now trying to figure out how to make it do it on the modal window
0
 
LVL 16

Expert Comment

by:Lolly-Ink
ID: 21880192
This example works for me:

<html>
<script type="text/javascript">
   document.cookie = "divBottom";
 
   function test()
   {
      window.location.hash = '#' + document.cookie;
   }
</script>
<body onload="test()">
   <div id="divTop" style="height:1000">Top</div>
   <div id="divBottom">Bottom</div>
</body>
</html>

Open in new window

0
 
LVL 4

Accepted Solution

by:
aumudin earned 0 total points
ID: 21880543
Yup your very correct that works perfectly just not in a modal window. Reason I have come to find out is IE renders to slowly but reads the code fast so the function even on the onload event executes befor it can find the anchors.

We ended up having to make JavaScript wait a few milliseconds and then it worked perfect.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

617 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