473,388 Members | 1,335 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,388 software developers and data experts.

Change in document.location value

25
Hi all

Look at the following code

[HTML]<html>
<head>
<script type="text/javascript">
document.location="http://www.gmail.com";
alert(document.location);
</script>
</head>
</html>[/HTML]

I am getting alert message as a location name what it was previously. It is not printing http://www.gmail.com.? What is the problem.?


Thanks
DNK2007
Feb 7 '08 #1
4 2352
gits
5,390 Expert Mod 4TB
the alert is executed before the new page is loaded ... when you set the location (and you should use location.href instead of location only) then a new page will be loaded, while the old one will be unloaded. so you know the href when you set it ... and you don't need to retrieve it from location.href ... may be it will be set when some request-status occurs ... and that may should take some time?

kind regards
Feb 7 '08 #2
DNK2007
25
the alert is executed before the new page is loaded ... when you set the location (and you should use location.href instead of location only) then a new page will be loaded, while the old one will be unloaded. so you know the href when you set it ... and you don't need to retrieve it from location.href ... may be it will be set when some request-status occurs ... and that may should take some time?

kind regards

Hi gits,

Thanks. After changing the location, can I access the form field names of newly located location so that I can set values for username, password.

Thanks
DNK2007
Feb 7 '08 #3
gits
5,390 Expert Mod 4TB
no ... that would be considered as a css = cross site scripting attac that you cannot do due to javascript's and the browsers security handling ...

kind regards
Feb 7 '08 #4
DNK2007
25
no ... that would be considered as a css = cross site scripting attac that you cannot do due to javascript's and the browsers security handling ...

kind regards

Thanks a lot. Is there some other way to acces them so that I can set the values?

Thanks
DNK2007
Feb 7 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robert Oschler | last post by:
I have a comparison web page that has several iframes that contain documents from external domain web sites. Some of the web sites are "trusted". If they want to change the top level document...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
1
by: MZ | last post by:
Hello! Is it possible to change URL form action on submit form... I have tried such code: <script language="JavaScript" type="text/javascript"> function changeURL() {
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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: 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
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
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...

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.