var scriptForHead = document.createElement('script');
scriptForHead.innerHTML = 'console.log("head");';
document.head.appendChild(scriptForHead);
var scriptForBody = document.createElement('script');
scriptForBody.innerHTML = 'console.log("body");';
document.body.appendChild(scriptForBody);