Skip to content
Say hello to beauvie
Beauvie - キレイを伝えるメディア
$(window).on('load', function() {
(function ($) {
var P = "/";
var D = window.location.origin;
var C = $("#content-main");
if(!!C.length){
P = "/"+C.attr("data-ref");
}
if (P != '/') {
$.ajax({
type: 'GET',
url: D + P,
dataType: 'html',
success: function (data) {
var parser = new DOMParser();
var doc = parser.parseFromString(data, "text/html"); //=> HTMLDocument
var headTag = "";
var bodyTag = "";
var bodyClass = "";
$(doc).find('head').each(function (index, el) {
headTag = $(this).html()
});
$(doc).find('body').each(function (index, el) {
bodyTag = $(this).html();
bodyClass = $(this).attr("class");
});
$("body").html(bodyTag).attr("class", bodyClass);
$("head").html(headTag);
}
});
}
})(jQuery)
});