저는 비교적 새로운 웹 페이지 디자이너입니다. 현재 문제는 콘텐츠를 동적으로로드하고 기록을 수정하는 웹 페이지가 있다는 것입니다. 나는 웹 페이지가 페이지에서 페이지로 이동함에 따라 동적으로 컨텐트를 변경할 수 있지만, 웹 사이트를 떠나 역사를 다시 사용할 때 404 페이지를 찾을 수 없다. 이 상황을 해결할 방법이 있습니까?내가 돌아온 후 동적 웹 페이지
<script type="text/javascript">
$(document).ready(function(){
$(function() {
$('#bodywrap').load('/common/index.php');
$('ul#nav li a').click(function(e) {
$("#loading").show();
href = $(this).attr("href");
loadContent(href);
// HISTORY.PUSHSTATE
history.pushState('', '', href);
e.preventDefault();
});
$(window).bind('popstate', function(event) {
$("#loading").show();
console.log("pathname: "+location.pathname);
loadContent(location.pathname);
});
});
function loadContent(url){
// USES JQUERY TO LOAD THE CONTENT
$('#bodywrap').load('/common/'+url+'.php');
$("#loading").hide();
$('li').removeClass('active');
$('a[href="'+url+'"]').parent().addClass('active');
}
});
</script>
내가이 작업을 수행하는 다른 방법의 인식입니다. 당신이 약간의 통찰력을 제공 할 수 있다면 나는 그것을 좋아할 것입니다 :) @BitwiseCreative –
지나치게 가정적이고 극적 이었기 때문에 제 의견을 삭제했습니다. @ 바네트 그로버 –
하하 걱정 마, 나는 이것에 대한 새로운 말로 그것을 사용하는 방법을 이해하려고 :) @ BitwiseCreative –