473,382 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Is top.location cross browser?

Assuming JS is enabled, what is the most cross browser for changing the
location of the page? I am currently use top.location. Works fine in IE 6,
Firefox 9, Opera 7, but I am not sure about older or other browers, like Mac
browser.

this.location
top.location
document.location
_top.location
Jul 23 '05 #1
4 6018
nntp wrote:
Assuming JS is enabled, what is the most cross browser for changing the
location of the page? I am currently use top.location. Works fine in IE 6,
Firefox 9, Opera 7, but I am not sure about older or other browers, like Mac
browser.

this.location
top.location
document.location
_top.location


The oldest Mac browser I have is IE, I guess I could test NS 4 if I
could find somewhere to download it from and you're really desperate.

I tested top.location in the following Mac browsers (listed in
alphabetical order for no particular reason):

Camino 0.7
Firefox 0.9.1
Internet Explorer 5.2.2
Mozilla 1.7
Netscape 7.2
Omniweb 5.0.1
Opera 6.03
Safari 1.0.3

Cheers, Fred :-)
Jul 23 '05 #2
> > this.location
top.location
document.location
_top.location


The oldest Mac browser I have is IE, I guess I could test NS 4 if I
could find somewhere to download it from and you're really desperate.

I tested top.location in the following Mac browsers (listed in
alphabetical order for no particular reason):

Camino 0.7
Firefox 0.9.1
Internet Explorer 5.2.2
Mozilla 1.7
Netscape 7.2
Omniweb 5.0.1
Opera 6.03
Safari 1.0.3

Cheers, Fred :-)


TESTED? Result? All passed?
I appriciate your time. Thank.
Jul 23 '05 #3
nntp wrote:
TESTED? Result? All passed?
I appriciate your time. Thank.


Sheesh, always with the questions... :-)

I realise I shoulda added "and they all passed".

Cheers, Fred.
Jul 23 '05 #4
VK
To address the same page where the script itself resides:
self.location.href = newURL;

To address another page in a frameset:
window.top.frameName.location.href = newURL;
or (hypercorrect):
window.top.frames['frameName'].location.href = newURL;

top.location addresses the topmost frame, which is semi-OK if there are no
frames (=self) or if you indeed want to replace the whole frameset with the
new address.
Otherwise the results will not be as expected.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
3
by: David Hayes | last post by:
I've made tooltips work in Firefox*, but tooltip doesn't appear at the specified location until the SECOND time that the user passes the mouse over the location with the mouseover event. What I...
13
by: Jerry Manner | last post by:
Hi I have a problem using the location.href("ProductL.htm") javascript code. Using this code on my system ( W98 SE, IE 6.0) is working correctly. But if a user has W2000 IE 5.0 it doesn't work....
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
9
by: permanent.tourist | last post by:
I'm having a hell of a job getting this to work in Safari: the only thing I can think of is that one can't use reload() across to another frame for security reasons. Does anyone have a concrete...
4
by: petermichaux | last post by:
Hi, I'm hoping for a reason I'm wrong or an alternate solution... I'd like to be able to dynamically include some javascript files. This is like scriptaculous.js library but their solution is...
15
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
2
by: Venkatesh | last post by:
Hello all, We have a micro site that is getting opened inside a popup window from some external main site (the domains of our microsite and main site are different) ... I need to support the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.