SharePoint App – Change Site Logo (Not AppIcon)

Adding this to your App.css

[sourcecode language=”css”]
.ms-siteicon-img {
display: none;
}

.ms-siteicon-a {
display: block;
position: relative;
background-image: url(‘https://placeholdit.imgix.net/~text?txtsize=33&txt=180×64&w=180&h=64’);
background-repeat: no-repeat;
background-position: center;
width: 180px;
height: 64px;
}
[/sourcecode]

will give you this

SiteLogo

Get ClientContext in SharePoint App

Add the following function

[sourcecode language="javascript"]
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

[/sourcecode]

Then you can use this to get ClientContext

[sourcecode language="javascript"]
siteUrl = getParameterByName("SPAppWebUrl");

var clientContext = new SP.ClientContext(siteUrl);
[/sourcecode]