473,688 Members | 3,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 50408


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.property Name

--

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************ *********@wagne r.videotron.net >,
do**********@ya hoo.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.hr ef

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.h ref="default.ht ml";
top.location.hr ef="default.htm l";
parent.location .href="default. html";
top.frames[2].location.href= "default.ht ml";
top.opener.loca tion.href="defa ult.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
37149
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 new blank window.. // (NOT in a pop-up, a regular new window..) can you do this?? thank you..
5
7527
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 IE. I link within a page and display individual divisions of that page, manipulating their visibility and display styles with an onClick function. As long as I explicitly click a link to progress, it works with browsers I've tried.
2
872
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 one exception. When the function is passed, the popup screen only displays the first part of the querystring. The email address returns: http://server.something.asp?Test=1 Should return something like this:
3
22997
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 alert messages) but nothing happens. FF acts like expected but i cant get it work in IE. What can be the problem here? here the code i use:
18
12685
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 state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
4
13080
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 write the search string to a # URL, either using window.location.href or window.location.hash. This works fine with no problems in IE and Firefox and works OK in Safari, except the browser goes into a permanent page loading state as soon as I...
5
12900
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 is that the parent url has a # sign in it, like: http://localhost/mysite/me.html#01 i need the #01 to stay in the url after the refresh, anyway to do
2
8793
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 that when using IE6 the page that is loaded doesn't register the referrer. in PHP - $_SERVER is null. I'm using this simple code: r = link.href;
1
6999
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) <script> (7) var fake = window.location;
0
8528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8782
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6453
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5807
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4321
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2964
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2215
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.