title: How to create master page file dynamically using JavaScript in SharePoint 2013 Online?
body: <p>I am creating one SharePoint App in that I want do following.</p>
  
  <ol>
  <li>In master page gallery, copy current master page and create new master page. (as we do new SharePoint Designer manually.)</li>
  <li>Inject JavaScript reference in new master page and save it.</li>
  <li>Apply new master page as default master page.</li>
  </ol>
  
  <p>All these should be done using JavaScript only.</p>
  
  <p>Does anybody know how to do ?</p>
  
  <p>Thanks
  user988917</p>