473,399 Members | 2,278 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,399 software developers and data experts.

difference between location.href and window.location.href?

Hi,

Is anyone know what is the difference between Location.href and
Window.location.href

Thanks you very much:)

Saiho
Jul 23 '05 #1
3 50355


saiho.yuen wrote:
Is anyone know what is the difference between Location.href and
Window.location.href


Both (Location.href and Window.location.href) will yield a script error,
if you are talking about location.href and window.location.href (notice
the different case of the first letter) then there is no difference in
global scope as you can reference global properties (e.g. those of the
window object) as both
propertyName
or
window.propertyName

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
saiho.yuen wrote:

Is anyone know what is the difference between Location.href and
Window.location.href


Ignoring the capitalisation errors, there is no difference.

If you specify window.location.href without the 'window.' it is
implicitly referenced.

--
Ben M.
Jul 23 '05 #3
In article <nc*********************@wagner.videotron.net>,
do**********@yahoo.com enlightened us with...
Hi,

Is anyone know what is the difference between Location.href and
Window.location.href

Thanks you very much:)


Javascript is case-sensitive.
window.location.href

There's a window object.
The window object has a location object as one of its properties.
The location object has href as a property.

As to the difference between the two, the difference comes up when it's not
really
window.location.href
but more like
top.location.href

You see a lot of references say window.location.href when what they really
mean is ANY window object.

So the following would all do different things in a nested frameset depending
on exactly where they executed:
self.location.href="default.html";
top.location.href="default.html";
parent.location.href="default.html";
top.frames[2].location.href="default.html";
top.opener.location.href="default.html"; // only for popup

I believe most browsers infer the window object as self if it isn't
specified, but I don't know that that is guaranteed. I myself always specify
the full window.location.href, JIC.

HTH
--
--
~kaeli~
Do not taunt Happy Fun Ball!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

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

Similar topics

14
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a...
5
by: spam_me_ not | last post by:
I already understand that one cannot disable a browser's forward and back functions. This is a situation where I have code working in Mozilla V1.6 and would like something similar for Opera and...
2
by: Brvsra | last post by:
Javascript Experts, I know very little about javascript and could use someone's help. I have created a function to send an email, listed below is the function. The function works fine, with...
3
by: Christian Hubinger | last post by:
Hi! I'm working on a page that uses javascript very much. My problem is now that i cannot redirect to another page in IE with window.location =<URL>; This command gets executed (proofed with...
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...
4
by: Jeff Paffett | last post by:
I'm writing a file manager application using Ajax techniques and the client wants to be able to bookmark file searches. I send the search request to a remote server using a XMLHttpRequest and then...
5
by: soni2926 | last post by:
Hi, I have a pop up window, that window needs to refresh the parent window when opened, I'm doing the following: window.opener.location.href(window.opener.location.href); problem I'm having...
2
by: henryrhenryr | last post by:
Hello I have a script which records a click and then sends the user to the location. The idea is to keep nice links in the HTML but still do some javascript when the link is clicked. I find...
1
by: Mihania | last post by:
Permission denied exception is fired in IE6 on line(9) during the following actions . (1)<html> (2)<head> (3) <title>Simple :: documentDomain :: Cars</title> (4)</head> (5)<body> (6) ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.