SP.AppInstance.webId property (sp.js)
Gets the identifier of the web where this app is installed.
Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
var value = SP.AppInstance.get_webId ()
Return value
The identifier of the Web.