title: Using SharePoint 2013 Cross-Domain Library in a simple web page: is it possible?
body: <p>I have a web page hosted on a server, say at <code>http://SVR1/path/index.html</code>, and I would like to access some list items in a on-premises SharePoint site hosted on another server, say at <code>http://SVR2/sites/mySite/</code>.</p>
  
  <p>The current installation of SharePoint I am using (not under my control) does not allow deployment of neither SharePoint-hosted nor Provider-hosted apps, so I am trying to use the SharePoint Cross-Domain library to access the desired list items from a purely external HTML5/JS/CSS3 page. I, as a user, have full access rights to the list in my SharePoint site, so I guess it should be no problem reading its items.</p>
  
  <p>Following an example found <a href="http://msdn.microsoft.com/en-us/library/office/fp179927%28v=office.15%29.aspx">here</a>, my page is as follows:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;!-- Title --&gt;
    &lt;title&gt;Application Template&lt;/title&gt;
    &lt;script language="javascript" type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
    &lt;script language="javascript" type="text/javascript"&gt;
  
      var hostweburl = "http://SVR2/sites/mySite";
      var appweburl  = "http://SVR1/path";
  
      // Load the required SharePoint libraries
      $(document).ready(function () {
  
        $("#renderList").html("Requesting Lists...");
  
        // resources are in URLs in the form:
        // web_url/_layouts/15/resource
        var scriptbase = hostweburl + "/_layouts/15";
  
        // Load the js files and continue to the successHandler
        $.getScript(scriptbase + "/SP.RequestExecutor.js", execCrossDomainRequest);
      });
  
      ///////////////////////////////////////////////////////
      // Function to prepare and issue the request to get
      //  SharePoint data
      function execCrossDomainRequest() {
        // executor: The RequestExecutor object
        // Initialize the RequestExecutor with the app web URL.
        var executor = new SP.RequestExecutor(appweburl);
  
        // Issue the call against the host web.
        // To get the title using REST we can hit the endpoint:
        //      hostweburl/_api/web/lists/getbytitle('listname')/items
        // The response formats the data in the JSON format.
        // The functions successHandler and errorHandler attend the
        //      sucess and error events respectively.
        executor.executeAsync(
            {
              url: hostweburl + "/_api/web/lists",
              method: "GET",
              headers: { "Accept": "application/json; odata=verbose" },
              success: successHandler,
              error: errorHandler
            }
        );
      }
  
      ///////////////////////////////////////////////////////
      // Function to handle the success event.
      // Prints the data to the page.
      function successHandler(data) {
        var jsonObject = JSON.parse(data.body);
        var listsHTML = "";
  
        var results = jsonObject.d.results;
        for (var i = 0; i &lt; results.length; i++) {
          listsHTML = listsHTML +
              "&lt;p&gt;&lt;h1&gt;" + results[i].Title +
              "&lt;/h1&gt;" + results[i].Body +
              "&lt;/p&gt;&lt;hr&gt;";
        }
  
        document.getElementById("renderList").innerHTML =
            listsHTML;
      }
  
      ///////////////////////////////////////////////////////
      // Function to handle the error event.
      // Prints the error message to the page.
      function errorHandler(data, errorCode, errorMessage) {
        document.getElementById("renderList").innerText =
            "Could not complete cross-domain call: " + errorMessage;
      }
    &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;h1 id="Root Page" style="text-align:center;"&gt;This is the home page&lt;/h1&gt;
    &lt;div id="renderList"&gt;Placeholder&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I load the page in a browser, in the javascript console I get an error: "Uncaught Error: Invalid field or parameter requestInfo.url.".</p>
  
  <p>I am under the impression that the problem is in the content of variable <code>appweburl</code> that, in all the examples I have found, is provided by SharePoint as part of the query part in the URL. But this implies that a provider-hosted app has been deployed in SharePoint - something I cannot do - and that this app is calling its remotely hosted counterpart.</p>
  
  <p>So the question is: Is it possible to use SharePoint cross-domain library in a page totally external to SharePoint, and if yes, how should I set <code>hostweburl</code>, <code>appweburl</code> and maybe other things to have access to SharePoint lists?</p>
  
  <p>Thanks in advance.</p>