How to insert html tags into electron webview while loading



How to insert few html tags into electron webview while loading. I tried below code in preload.js but that doesn’t have any effect.


window.onload = function() {
    var script = document.createElement("script");
    script.src = "";
    script.onload = script.onreadystatechange = function() {
      $(document).ready(function() {

      document.getElementsByTagName("head")[0].innerHTML += "<div id="google_translate_element"></div><script type="text/javascript">function googleTranslateElementInit() {new google.translate.TranslateElement({pageLanguage: 'de', includedLanguages: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');}</script><script type="text/javascript" src="//"></script>";



<!DOCTYPE html>
    <title>jQuery injection into webview preload</title>
  <body style="overflow:hidden;">
    <webview id="webview" preload="./preload.js" src="" style="position:absolute;width:100%;height:100%;"></webview>


Expected Result :
Page has to loaded with translate tag on top

Current result :
No translate tag is appearing