Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refresh partial content with new URLs?

Tags:

html

url

partial

I want that some sections on my page to remain (like header, footer) and only the main content to change. In the same time, the URL should also change, according to the new content.

I know all about AJAX/iframes but I don't want to use them as the URL remains the same.

Take a look please at 123contactform.com. Try to play around with the left menu and notice that the main content changes and also the URL (while the header, menu, footer stays).

How is this achieved?

Thanks.

like image 577
CristiC Avatar asked Nov 20 '13 19:11

CristiC


People also ask

How do I refresh a specific part of a Web page?

Refreshing part of a page periodically You can use the frame “reload” function periodically in frameset page itself. In the above code, “right_frame” reloads every second. setInterval() function is very closely related to setTimeout() – both have similar syntax: setInterval ( expression, interval );

How do I automatically refresh part of an HTML page?

Approach 1: One can auto refresh the webpage using the meta tag within the head element of your HTML using the http-equiv property. It is an inbuilt property with HTML 5. One can further add the time period of the refresh using the content attribute within the Meta tag.

Which technique is used to refresh the particular part of a web page is not whole webpage?

This is typically achieved with a technique called AJAX. This technique loads data asynchronously (in the background) so it can update your content without needing to reload the page. The easiest way to implement AJAX is with the jQuery load() method.


1 Answers

Actually the webpage you give does not only refresh its content. It may look that way, but you can see that header is still flickering aka refreshing(also if you change the content live it will change when you click a link)

There is actually a whole new page. But they use templates to create the content.

One page is a template website that calls different fractions of the webpage(ie footer, header and content). Where the content can just have an other content based on the given input.

This can just be done with php.

Template.php

include "header.php";

include $contentpage;

include "footer.php";

Where you give differnt content file names that you want to load.

Header.php

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Page title</title>
</head>
<body>
BLALBLA CONTENT

content.php

echo $content;

footer.php

</body>
</html>

This together will create one page wtih a dynamic content and a static header and footer( where you can also add static scripting).

This is just a basic idea on how you can achieve this.

The static content(header and footer) might as well be cashed to load it faster.

Additional info why i think this

Also when you open the link into a tab, you will see that every of that link will contain the header. As with, for example, an iFrame only the dynamic content will be shown in the link.

like image 189
nkmol Avatar answered Sep 22 '22 23:09

nkmol