Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with URL

TONI-BCN
Guest
 
Posts: n/a
#1: Nov 30 '05
I have a HTML page, for example http://www.mypage.html.

If I want to go to www.google.com, is some way to be able to recover
with Javascript "www.google.com"?

I have tried it with window.location, etc but she does not serve to me
since it shows "http:www.mypage.html to me".

Thank you very much


VK
Guest
 
Posts: n/a
#2: Nov 30 '05

re: Problem with URL



TONI-BCN wrote:[color=blue]
> I have a HTML page, for example http://www.mypage.html.
>
> If I want to go to www.google.com, is some way to be able to recover
> with Javascript "www.google.com"?
>
> I have tried it with window.location, etc but she does not serve to me
> since it shows "http:www.mypage.html to me".[/color]

If I uderstand you properly, you want to navigate from
http://www.myserver.com/mypage.html to http://www.google.com using
JavaScript ?

Then you may do it in this way:

window.location.href = "http://www.google.com";

Randy Webb
Guest
 
Posts: n/a
#3: Nov 30 '05

re: Problem with URL


VK said the following on 11/30/2005 6:07 AM:[color=blue]
> TONI-BCN wrote:
>[color=green]
>>I have a HTML page, for example http://www.mypage.html.
>>
>>If I want to go to www.google.com, is some way to be able to recover
>>with Javascript "www.google.com"?
>>
>>I have tried it with window.location, etc but she does not serve to me
>>since it shows "http:www.mypage.html to me".[/color]
>
>
> If I uderstand you properly, you want to navigate from
> http://www.myserver.com/mypage.html to http://www.google.com using
> JavaScript ?
>
> Then you may do it in this way:
>
> window.location.href = "http://www.google.com";
>[/color]

He wants to know where you are attempting to go before you leave the page.

You are on Page1.html and type in www.google.com in the address bar, he
wants to know that before you leave the page.

The answer is No unless they are leaving via a link on your page.
Otherwise, you have no reliable secure way of knowing where they are
going, only that they are going.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Closed Thread