474,044 Members | 35,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change in document.locati on value

25 New Member
Hi all

Look at the following code

[HTML]<html>
<head>
<script type="text/javascript">
document.locati on="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 2404
gits
5,390 Recognized Expert Moderator Expert
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 New Member
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 Recognized Expert Moderator Expert
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 New Member
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
8570
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 location (document.location.href) via Javascript or using "_TOP" as the target for a SUBMIT operation, etc., then I want to allow it. The other web sites I want to block if they try to do that. I would do the blocking in the top level document...
2
5327
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 RWD <script type='text/javascript'>
4
2653
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 QA tested for a new year release. I don't think that going to prove practical, but there is no harm in trying :) and some serious family commitments. But it has to be done soon so this is stage one. Mike Winter provided an extensive list of...
4
6329
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> Anderas
1
21939
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
10546
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10337
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
11602
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
11141
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8698
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
6652
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
5416
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
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.