2015-05-30 39 views
0

我有這個網站:如何強制href指向外部主機頁面?

<a href="http:/myhost.com/tiles/internal?lineGeom=(-71.1208,42.3317,-71.1052,42.3261,-71.0872,42.3354,-71.0570,42.3295,-71.0376,42.3394),(-71.1208,42.3317,-71.0754,42.3311,-71.0617,42.3428,-71.0376,42.3394),(-71.1208,42.3317,-71.0675,42.3525,-71.0376,42.3395)">live map</a> 

我在瀏覽器中打開它,內容如下:

http://localhost:63342/RoutingRegression/html_pages/delta_to_baseline_table/delta_to_baseline_samples_agg_fresh.html#astar_improve

,當我按下鏈接我的直接到:

http://localhost:63342/myhost.com/tiles/internal?lineGeom=(-71.1208,42.3317,-71.1052,42.3261,-71.0872,42.3354,-71.0570,42.3295,-71.0376,42.3394),(-71.1208,42.3317,-71.0754,42.3311,-71.0617,42.3428,-71.0376,42.3394),(-71.1208,42.3317,-71.0675,42.3525,-71.0376,42.3395) 

我該如何改變它:(新的http頁面):

"http:/myhost.com/tiles/internal?lineGeom=(-71.1208,42.3317,-71.1052,42.3261,-71.0872,42.3354,-71.0570,42.3295,-71.0376,42.3394),(-71.1208,42.3317,-71.0754,42.3311,-71.0617,42.3428,-71.0376,42.3394),(-71.1208,42.3317,-71.0675,42.3525,-71.0376,42.3395)" 

更新

怎麼能說是,它的產生的 「http:/」 的不是 「http://」?

這是我的網址構建器:

UriBuilder builder = UriBuilder 
      .fromPath(Constants.LIVEMAP_BASE_URL_US) 
      .scheme("http"); 
    return builder.build().toString(); 
+0

如果你想要一個新的瀏覽器窗口,你需要在你的標籤中添加target =「_ blank」。和該網址應該是http:// ... – Gilko

回答

3

似乎您的網址是不正確

變化

http:/myhost.com 

http://myhost.com 
+0

謝謝。請參閱我的更新 –

+0

我不知道什麼是'UriBuilder',它是我猜的Java。它會以一個斜槓返回'http:/myhost.com/...',這就是'UriBuilder'我猜的方式。 試試這個'返回新的URL(builder.build()。toString());' – Hovo

0

你需要把雙/ /在你的網址是這樣的:

http://myhost.com/tiles/internal?lineGeom=(-71.1208,42.3317,-71.1052,42.3261,-71.0872,42.3354,-71.0570,42.3295,-71.0376,42.3394),(-71.1208,42.3317,-71.0754,42.3311,-71.0617,42.3428,-71.0376,42.3394),(-71.1208,42.3317,-71.0675,42.3525,-71.0376,42.3395) 
+0

謝謝。你能看到我的更新嗎?\ –