title: content script in chrome extension
body: <p>i have to add div in google search page through chrome extension 
  my inject.js file is as follow:</p>
  
  <pre><code>var body=document.getElementById("search");
  
  //creates bar and creates bar removal function
  var bar = document.createElement("DIV");
  function removeBar(){
    bar.remove();
  }
  
  //styles bar
  var ds = bar.style;
  ds.position = "fixed";
  ds.width = "512px";
  ds.height = "33px";
  ds.background = "rgba(0,0,0,0.86)";
  ds.zIndex = "9999999999999";
  
  //creates X button and makes it so clicking it runs the removeBar() function
  var x = document.createElement("BUTTON");
  x.onclick = removeBar;
  bar.appendChild(x);
  
  //styles button
  var xs = x.style;
  xs.background = "black";
  xs.borderColor = "black";
  xs.color = "rgba(255,255,255,.86)";
  xs.position = "fixed";
  xs.left = "100%";
  xs.marginTop = "5px";
  xs.marginLeft = "-29px"
  
  //puts X in button
  var xtext = document.createTextNode("X");
  x.appendChild(xtext);
  
  //puts bar in page
  body.insertBefore(bar, body.children[0]);
  </code></pre>
  
  <p>and my manifest.json is as follow:</p>
  
  <pre><code>{
    "manifest_version": 2,
    "name": "Inject script in webpage",
    "version": "2.0.1",
    "description": "inject script in webpage.",
  
    "icons": {
      "48" : "sample-48.png",
      "128" : "sample-128.png"
    },
    "content_scripts": [
      {
        "matches": ["https://www.google.com.pk/*"],
        "js" : ["inject.js"],
        "all_frames": true
      }
    ]
  }
  </code></pre>
  
  <p>but when i load google SERP page, error message shows somewhat like " cannot call "insertBefore" property of null", it seems that variable "body" is undefined. by inspect element of google page i checked that DIV with ID "search" is present if i am doing it wrong then plzz let me know i am novice in chrome extension development</p>