[Webinar] Streamline your web hosting managementRegister Today


Firefox new page and jump to bookmark

Posted on 2008-01-26
Medium Priority
Last Modified: 2013-12-07

I have been web designing using Internet Explorer for many years. Now due to the growing popularity of the Firefox browser I would like my sites to look and demonstrate the same behaviour on both.

Two things are causing me problems. Firstly when I use the target="_blank" tag in IE it opens in a new window (as desired) however in Firefox it opens in a new tab. This is not what I wish to happen. How can I make it open in a new window?

Also in IE on one of my pages as soon as it loads it jumps to a bookmark further down the page (as desired) however in Firefox the bookmark is ignored and it starts at the top of the page. How do I make it jump straight to the bookmark?

Any ideas folks?
Question by:coolarmani
LVL 82

Accepted Solution

hielo earned 1500 total points
ID: 20750819
>>Firefox it opens in a new tab
This is because the browser is configured to open "new windows" in a tab rather than a new browser instance. It's a user preference, which you cannot change programmatically. If anything you might want to try:
<a href="http://somesite.com" onclick="window.open(this.href,'blank','scrollbars=1')>Resources</a>
Look up the options (third argument) to window.open().

>>however in Firefox the bookmark is ignored and it starts at the top of the page
Last time I tested this, it worked perfectly fine. You just need to make sure that:
a. the "bookmark" exists
b. you added the "bookmark" to the end of the url. Ex: http://somesite.com/index.html#resources
3. you spelled the "bookmark" exactly as specified on the HTML code. #bookmark and #Bookmark are not treated the same

Author Comment

ID: 20753675
Thanks for the reply and for confirming my suspicions that it was not possible to overrule default firefox settings. (new page in new window/tab).

The second is basically as I was already doing but I have now managed to solve the issue.

I needed to add an additional:-
<script>window.location.href = "#bookmark";</script>

I already had one positioned just after the <BODY> tag but I needed to add another just before the </BODY> tag. If I only had the one after the <BODY> it would not work in Firefox and if I only had the one before the </BODY> tag it would not work in Internet Explorer. By including both it now works on both browsers.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

591 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