In general, there is a code. Follows a link with ajax without refreshing the page. But if you copy the url and paste it in a new window, then only the content of the content is displayed. How to make the whole page appear

$('.menu__link').click(function() { var url = $(this).attr('href'); $.ajax({ url: url + '?ajax=1', success: function(data){ $('#content').html(data); } }); if(url != window.location){ window.history.pushState(null, null, url); } return false; }); $(window).bind('popstate', function() { $.ajax({ url: location.pathname + '?ajax=1', success: function(data) { $('#content').html(data); } }); 

});

  • Through anchors this is done (hash). When clicking on a link, change the location.hash . Accordingly, when visiting a page, read the hash and download the content - ArchDemon
  • I am interested in moving to another page as follows ("/name-page.html") - Michael Disco

1 answer 1

The browser displays what the server gives it. The server gives the url "only content" - the browser displays it.

I can assume that the "ajax" parameter indicates to the server that it is necessary to return: "only content" or the whole page.

Try to specify a link with ajax = 0 in the new window (if the server part is not yours). Well, or make sure that the server returns a full page in the usual (not ajax) request.

You can determine that ajax request was sent to the server by the presence of the X-Requested-With HTTP header.