In the MSDN article linked to from this question by @JamesWood, there’s this code passage (paraphrased here) for obtaining the server’s name.
function getServerUrl(){
var serverUrl = this.context().getServerUrl()
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}
return serverUrl;
}
I’m not a JS nor RegEx guru but it seems to me that there’s a possibility of a slash character to be superfluously added at the end of the URL, which we need to deal with.
However, all the answers provided to the said question seem to omit that issue. Did the responders miss that or is the code too protective and can its control be relaxed?
As far I’ve seen, there’s no difference in on-line and on-premise solutions when it comes to the slash at the end. My explanation is that it’s either a left-over from some older setup or, which is more likely to be the case, a better-safe-than-sorry approach.
I’ve never used that and I’ve had no issues with the extra slash. Maybe for federated solution…
My suggestion is that you skip it but that you also keep it in mind making a mental note. In case there will be some strage URL related problems, it could be something to check.