You can use Angular.js and Angular-route.js,
would look like this:
HTML page
<html ng-app="TesteApp">
<head>
<meta charset="UTF-8">
<title>Teste Rotas</title>
</head>
<body>
<a href="#/pagina-1">Pagina 1</a>
<a href="#/pagina-2">Pagina 2</a>
<h1> Master Page </h1>
<div ng-view>
<!--Dentro da div ng-view , será renderizado nossas partials-->
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js"></script>
<script src="main.js"></script>
</body>
main.js file
//Modulo do app
var app = angular.module("TesteApp", ['ngRoute']);
//Configuração das rotas
app.config(function ($routeProvider) {
$routeProvider
.when("/pagina-1", { //URL
templateUrl: "caminho/pagina-1.html", //Caminho da pagina HTML
controller: "nomeController" //controller que será usado
})
.when("/pagina-2", { //URL
templateUrl: "caminho/pafina-2.html", //Caminho da pagina HTML
controller: "nomeController" //controller que será usado
})
.otherwise({ redirectTo: '/pagina-1' }); //Se não for nenhuma url , redireciona para esta
});
app.controller("nomeController",function($scope){ //Controller
$scope.mensagem = "Olá"
});
And then as the URL changes, the pages will be rendered inside the ng-view div.
Take a look in that reply of mine
– Marcus Vinicius
I would say that the best way to solve this situation is by using html templates. At this link you can find several options according to what suits you best.
– Jorge Raimundo