Link to home
Start Free TrialLog in
Avatar of david_off
david_off

asked on

calling location.href from javascript in firefox doesn't work

Hello,

My problem is the following:
I want to automatically redirect or move to specific bookmark under HTML using directive location.href from javascript.

Here is the example:

<HTML>
<HEAD>
</HEAD>
<BODY>
<script language="JavaScript">
    location.href='#tokens';
</script>
.
.
.   <!—Bookmark-->
<a name="tokens"></a>
.
.
.
</BODY>
</HTML>

In IE the example above works fine, but in firefox doesn't.
Instead of move to specific bookmark I got an empty page.

I assume this is because Firefox doesn't find the bookmark at that time because the rest of the page it's not loaded yet.
I've tried to move javascript at the end of the page, but it does not work either.(At least I don't get an empty page, but it does not move to the bookmark)

Does anyone know what could be the issue and how to fix it?

Thanks,

Herman
ASKER CERTIFIED SOLUTION
Avatar of dakyd
dakyd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you explain why do you grade our support to you with a grad of B?
Avatar of david_off
david_off

ASKER

That is because I clicked "good" when I accepted an answer.
Why I did not click "excellent" is because your answers did not solve my problem at first hand, but it definitely helped me to solve it.

That’s what I did:

"onload" directive or property is definitely what I needed.
We can use "onload" directive like this:
1. <BODY onload="location.hash='tokens'">
or like this
2.<BODY>
<script type="text/javascript">
   window.onload = init;
   function init()
   {
        location.hash='tokens'
   }
</script>

I chose the second option.

That’s why I splited points on half to show, that both of your answers helped me solve my problem. I hope it is fair enough.

So, thanks to both of you again.

rg,

Herman
You are welcome.
And thanks for the feedback.
But if you were such good that you could grade how execlent or not our solution was, then you had not ask questions.
So is the grading only a ThankYou for the valuable time of Experts that supported you.
Give grade B only if you get dissappointed after several requests for clarification.
The next time ;-)

So long,
Zvonko
As a matter of fact I grade your answers only because I was forced by page to do so.
There were 4 grade options if I remember correctly:
-Excellent (the answer is perfect hit)
-Good (the answer is very helpful, but needs a little more experimenting)
-Average (the answer maybe gives you new ideas)
-Poor (the answer is insufficient)

That's how I see this grading.

I would say, that expert-exchange web designers gave this option on this page to make
customers able to grade the answers they've got.
The customers are giving their points (bought) away to get an answer, so I think this approach is completely correct to grade an answer.

<But if you were such good that you could grade how excellent or not our solution was, then you had not ask questions.> I do not see problem here. Customers are "paying" for answers and so do I. And I think they have rights to grade an answer they got.
I bought my points because I have no time to earn it.

<Give grade B only if you get disappointed after several requests for clarification.> For that I would give "poor" (grade E if I’m correct.)

But I could be wrong :)

rg,

Herman
All what i'm trying to say is, that your answers helped me to solve my problem.

A or B grade does not matter. If this has any impact for you I give you an 'A'.

So for all who are reading this: Zvonko and dakyd have repsonded very quickly with right information and they deserve an 'A'.

Rg,

Herman

>> I do not see problem here. Customers are "paying" for answers and so do I. And I think they have rights to grade an answer they got.
>>I bought my points because I have no time to earn it.

But realize that you are getting some AMAZING IT professionals consulting time for a measly 10 dollars a month and try to respect that most can bill for WELL above that at an hourly rate, billing in quarter hour increments.


Thanks :-)
Thanks Lunchy.
Thank you Herman.
No problem.

Once again, you helped me to solve my problem and i'm very grateful for that.

rg,

Herman