2017-03-05 22 views
1

I tried to open the content pages in using a javascript. So, I don't have to write all the header and footer pages. However, there is a problem, the url is not show in the navigation bar. Are there anyway to make the real url show up in the navigation bar? http://www.page.com/test.phpを使用しているときにナビゲーションバーに実際のURLを表示するにはどうすればよいですか?<a href="#" onclick="funtion('test.php')">

<script> 
 
\t function openLink(url) { 
 

 
\t \t $(".contentTable").load(url); 
 
\t \t \t 
 
\t } 
 
</script>
<a id="link1" href="#" onclick="openLink('test.php')">Link</a>

答えて

0

あなたのブラウザの履歴APIを使用する必要があるようです:

https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method

例:

history.pushState({}, "New page test", "/test.php"); 

まずparamがAであります状態、2番目のタイトルと第3のあなたのURL。

pushStateは履歴にエントリを追加し、replaceStateは現在の履歴状態を新しいものに置き換えます。

関連する問題