The problem is with href url you are using.
If you'll try to put it to the HTML directly (without
Sinatra or HAML):

``` html
link
```

You will get same result (in fact browser simply treats this
URL as relative to current one). The correct way for you is:

``` haml
%a{:href => "//www.google.com"}link
```

Or with specifying protocol directly

``` haml
%a{:href => "http://www.google.com"}link
```

NOTICE, that if you are not specifying a protocol, e.g.
`//foobar.com` then browser will automagcally use the protocol
of your current URL.

On Thu, Jun 14, 2012 at 10:08 AM, Bin Jin <lists / ruby-forum.com> wrote:
> main.rb:
>
> require 'sinatra'
>
> get '/' do
>  haml :index
> end
>
>
> views/index.haml:
> %a{:href => "www.google.com"}link
>
> when i run this program and click link in html page, it will direct to
> localhost/www.google.com when i expected just www.google.com.
>
> so what is the problem and how to solve this problem ?
>
> --
> Posted via http://www.ruby-forum.com/.
>



-- 
Sincerely yours,
Aleksey V. Zapparov A.K.A. ixti
FSF Member #7118
Mobile Phone: +34 677 990 688
Homepage: http://www.ixti.net
JID: zapparov / jabber.ru

*Origin: Happy Hacking!