2017-03-05 9 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')">

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

이 예는 :

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

먼저 PARAM가 있습니다

<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를 사용할 필요가 보인다 상태, 두 번째 제목 및 세 번째는 귀하의 URL입니다.

pushState가 기록에 항목을 추가하고 replaceState가 현재 기록 상태를 새로운 것으로 바꿉니다.