summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-03 11:28:07 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-02-03 11:28:07 +0100
commitaef43816c2a874c55896a6ba45edcee39eb899b9 (patch)
treed1fbf37d8d5f93b18987f189d858181d2e77423b /core
parentd66a836251c6c17b31331f2a2816d5ccb059997d (diff)
downloadnextcloud-server-aef43816c2a874c55896a6ba45edcee39eb899b9.tar.gz
nextcloud-server-aef43816c2a874c55896a6ba45edcee39eb899b9.zip
host and hostname are different things
host can contain the port (host of http://example.com:1234 is example.com:1234) while hostname never contains a port. They can however be similar. If you navigate to http://example.com then both host and hostname will be example.com. * Fixed docs * added getHostName function
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js
index bc8c51e40d3..83658a537b8 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -243,9 +243,15 @@ var OC={
},
/**
- * Returns the host name used to access this ownCloud instance
+ * Returns the host used to access this ownCloud instance
+ * Host is sometimes the same as the hostname but now always.
*
- * @return {string} host name
+ * Examples:
+ * http://example.com => example.com
+ * https://example.com => exmaple.com
+ * http://example.com:8080 => example.com:8080
+ *
+ * @return {string} host
*
* @since 8.2
*/
@@ -254,6 +260,17 @@ var OC={
},
/**
+ * Returns the hostname used to access this ownCloud instance
+ * The hostname is always stripped of the port
+ *
+ * @return {string} hostname
+ * @since 9.0
+ */
+ getHostName: function() {
+ return window.location.hostname;
+ },
+
+ /**
* Returns the port number used to access this ownCloud instance
*
* @return {int} port number