473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What is the right IE version for command location.href?

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. When using this code
the browser shows an error on page in the statusbar. If I click on the
statusbar to find out what is causing the error I see this description
'The property of this method is not supported by this object' ( I have
translated this in English, my IE browser is in dutch)

Does the location.href only work for a certain version of IE?

Regards

Jul 23 '05 #1
13 2147

Jerry Manner wrote:
I have a problem using the location.href("ProductL.htm") javascript
code.


Try to assign to the property e.g.
location.href = "ProductL.htm"
your code looks like a function call.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Hi

I have tried what you said, but that gave me the same result. Is
location.href only working for a certain version of IE?

Jul 23 '05 #3
Lee
Jerry Manner said:

Hi

I have tried what you said, but that gave me the same result. Is
location.href only working for a certain version of IE?


No, it works in all versions. Post *exactly* what you are trying.

Jul 23 '05 #4
Hi

Here is the original code which is working for my system ( W98 SE, IE
6) but not for another person ( W2000, IE 5).

function CheckLogin() {

var textField = document.getElementById("T1");

if (textField.value == 'Marjolein Visser')
{
location.href("IntranetP.htm");
}
else if (textField.value == 'Hans Veerkamp')
{
location.href("IntranetELP.htm");
}
else if (textField.value == 'Steven Badle')
{
location.href("IntranetSBadleP .htm");
}
}

This function is alled from an onclick event of a image.

Jul 23 '05 #5


Jerry Manner wrote:

Here is the original code which is working for my system ( W98 SE, IE
6) but not for another person ( W2000, IE 5).
What happens there, any error messages?

function CheckLogin() {

var textField = document.getElementById("T1");

if (textField.value == 'Marjolein Visser')
{
location.href("IntranetP.htm");
As said it should be an assignment
location.href = "IntranetP.htm"
at least if you want to write cross browser code for the web, the
function call might work with an IE/Win only intranet.

location.href("IntranetSBadleP .htm");


You need to escape the space character
"IntranetSBadleP%20.htm"
in a URL, that is the only thing that I see that might cause problems.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #6
Hi

The sapce was an error in the posting. In the code there is no space. I
did change the location.href("IntranetP.htm")*; into location.href =
"IntranetP.htm", but that resulted in the same error ''The property of
this method is not supported by this object'

Jul 23 '05 #7


Jerry Manner wrote:

The sapce was an error in the posting. In the code there is no space. I
did change the location.href("IntranetP.htm")*; into location.href =
"IntranetP.htm", but that resulted in the same error ''The property of
this method is not supported by this object'


I am not sure what could be causing this and therefore have to keep
suggesting other attempts as a guess work, you could try whether
directly assigning
location = "IntranetP.htm";
solves that problem. The location object is a bit magical in allowing an
assignment to itself when you want to set the href property.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #8
Jerry Manner wrote:
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. When using this code
the browser shows an error on page in the statusbar. If I click on the
statusbar to find out what is causing the error I see this description
'The property of this method is not supported by this object' ( I have
translated this in English, my IE browser is in dutch)

Does the location.href only work for a certain version of IE?

Regards


"Object doesn't support this property or method" is the error we'd see
in English browsers. Essentially, the location object (if it exists)
doesn't have a member named href.

Since all versions of IE since and including at least 4.0 support the
location object and the href member of it, this suggests to me that the
location object you're working with is not what we might expect it to
be. For instance, if your function is being called as a member of an
object that also has a location member, then the unqualified reference
to location will refer to the object's location member and not the
window's location.

If assigning to the location object doesn't work, try fully-qualifying
it as window.location.href

window.location.href = 'File.html';

Jul 23 '05 #9
Christopher J. Hahn wrote:
<snip>
Since all versions of IE since and including at least 4.0
support the location object and the href member of it,
this suggests to me that the location object you're working
with is not what we might expect it to be. For instance, if
your function is being called as a member of an object that
also has a location member, then the unqualified reference
to location will refer to the object's location member and
not the window's location.


Unqualified identifiers are resolved against the function's scope chain
so even if the function was called as a method of an object with a -
location - property the unqualified identifier would not be resolved as
a reference to that object property, unless that object had been added
to the function's scope chain explicitly.

Explicitly adding a custom JS object to the scope chain of a function
requires that the function be created in a - with - statement, which is
only possible with function expressions. The OP's posted code is not a
function expression, but might just about be an inner function
declaration inside a function expression. Though that is extremely
unlikely (and it would be another serious omission on the OP's part not
to have included the outer function(s) with the code).

Richard.
Jul 23 '05 #10
<Since all versions of IE since and including at least 4.0 support the
<location object and the href member of it, this suggests to me that
the
<location object you're working with is not what we might expect it to
<be. For instance, if your function is being called as a member of an
<object that also has a location member, then the unqualified reference

<to location will refer to the object's location member and not the
<window's location.

Hi

I call my JS function in an onclick event of an image like this
onclick="CheckLogin()". Further, if I look at the entire html code on
the page I see that the location member is only used in the JS function
I placed in my original posting

Jul 23 '05 #11
Richard Cornford wrote:
Christopher J. Hahn wrote:
<snip>
Since all versions of IE since and including at least 4.0
support the location object and the href member of it,
this suggests to me that the location object you're working
with is not what we might expect it to be. For instance, if
your function is being called as a member of an object that
also has a location member, then the unqualified reference
to location will refer to the object's location member and
not the window's location.


Unqualified identifiers are resolved against the function's scope chain
so even if the function was called as a method of an object with a -
location - property the unqualified identifier would not be resolved as
a reference to that object property, unless that object had been added
to the function's scope chain explicitly.

[snip]

Of course you're right. The example I cited was flawed and wouldn't
apply in this case.

I think it still stands that, given the error message, the 'location'
object being worked with probably is not the window.location we would
expect it to be. There is too little information to say exactly why
that would be in this case.

Ah well. Was hoping to contribute in some way to an unresolved question.

Jul 23 '05 #12
Jerry Manner wrote:
<Since all versions of IE since and including at least 4.0 support the
<location object and the href member of it, this suggests to me that
the
<location object you're working with is not what we might expect it to
<be. For instance, if your function is being called as a member of an
<object that also has a location member, then the unqualified reference

<to location will refer to the object's location member and not the
<window's location.

Hi

I call my JS function in an onclick event of an image like this
onclick="CheckLogin()". Further, if I look at the entire html code on
the page I see that the location member is only used in the JS function
I placed in my original posting


What happens if you use
window.location.href = 'someFile.html';
instead?

Jul 23 '05 #13
Hi

it is working now. If I use location.href = "somefile.htm" it sends the
user to that page. I don't know why it did not worked the first time I
used the same code. But it is working now.

Thank you all for your help!!!!

Jul 23 '05 #14

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

Similar topics

56
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version...
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
14
by: Frances Del Rio | last post by:
if (parent.frames.main.location == 'mediaselect.html') { I have a very simple frameset, name of frame where I'm checking is 'main'... why is this not working? I mean this is correct syntax,...
3
by: Jim Cobban | last post by:
I have a set of web pages that are organized in pairs. One of each pair contains a graphic and the other is an extended description of the graphic. I am trying to set it up that selecting a single...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
26
by: Lasse Edsvik | last post by:
Hello I'm trying to build a simple COM+ app in vs.net using C# and i cant register it in component manager..... what more is needed than this: using System; using...
8
by: johnsonholding | last post by:
Here is the code for a pop-up window that works in Firefox and not in IE - I get a java error or something, Here is the code : </script> <SCRIPT language="JavaScript"...
8
by: Thaqalainnaqvi | last post by:
Several times I logged-in successfully but after log-in I can't use features/services which were shown prior to my login. Can anyone exoert from this forum check , is it technical fault of Bank...
3
by: stephen.cunliffe | last post by:
Hi all, This may sound real strange, but I'm curious what the "official" answer is. In my JS, I want to redirect/navigate to a url... In Mozilla, document.location.href = '{my_url}'; ...
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
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.