I created a sharepoint hosted app with 2 lists inside,

I then added a sharepoint app part to my app. The app.js code inside is the same, its working in my app but when i add the app part to my site it says: L_Menu_BaseUrl is not defined

I use L_Menu_BaseUrl in my url for a ajax call to retrieve the list in the app.

webservice = window.location.protocol + "//" + window.location.hostname + port + L_Menu_BaseUrl + "/_vti_bin/lists.asmx";
  • L_Menu_BaseUrl should not be relied upon as it is not intended to be a part of the Microsoft provided API. If the user does not have the site saved in the Local Intranet zone, you will see the error that you described. Jun 12, 2014 at 16:13

1 Answer 1


You can use the _spPageContextInfo.webAbsoluteUrl variable instead of building the entire url yourself.

var webservice = _spPageContextInfo.webAbsoluteUrl + "/_vti_bin/lists.asmx";
  • Okey, the _spPageContextInfo works in the app. But not if i add the app as a iframe ( a app part), then it says: _spPageContextInfo is not defined
    – Anders
    Jun 12, 2014 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.