Create node from JSON
Here is a little working piece of code for you. You may extend it according to your needs

document.onselectionchange = function() {
    var selectedText = "";
    $('div').mouseup(function() {
      //Save selected text in localStorage.
      selectedText = window.getSelection().toString();
      if (selectedText.length &gt; 10) {
        var noteData={
          "sourcePath": window.location.href,
          "selectedText": selectedText
        };
        localStorage.setItem('noteData', JSON.stringify(noteData));
        window.location.href = '/node/add/page';
      }
    });
  };

  // Get saved data from localStorage and insert in the form.
  var savedNoteData = JSON.parse(localStorage.getItem('noteData'));
  if (savedNoteData &amp;&amp; savedNoteData.selectedText) {
    $('.form-item-title input').val(savedNoteData.selectedText);
    localStorage.setItem('noteData', '');
  }