2012-07-10 89 views
0

我想在我的網頁上創建一個鏈接,我只是想從我的網站打開www.google.com。如何從鏈接中打開地址

我的標籤是這樣的: <a target='_blank' href='www.google.com'>,它是打開此鏈接http://localhost:78/efm/efm21/www.google.com

我讀過一些文章,他們說那裏使用../回去一個目錄中的我來說,我不得不搬到.. /../../爲了達到只有www.google.com被打開我仍然堅持它,它打開localhost:78/www.google.com.

我的問題是我怎麼直接打開www.google.com從鏈接。

回答

3

您必須指定相對於協議或更高協議的完整路徑。

<a href="//www.google.com/">link</a> 
or 
<a href="http://www.google.com/">link</a> 
4

添加協議HTTP://

<a href="http://www.google.com">Google</a> 
+0

謝謝你,工作。 – Lulzim 2012-07-10 00:33:45

0

你必須指定協議,否則瀏覽器將嘗試打開一個叫上你的網站www.google.com文件。

您有兩種選擇。

#1:

<a href="//www.google.com" target="_blank">將打開谷歌與您的網站的相同的協議,例如

https://example.com 

將打開

https://www.google.com 

http://example.com 將打開

http://www.google.com 

#2:

<a href="http://www.google.com" target="_blank"><a href="https://www.google.com" target="_blank">將打開谷歌與HTTPHTTPS,通過您的網站的協議的影響。