]> source.dussan.org Git - nextcloud-server.git/commitdiff
host and hostname are different things
authorRoeland Jago Douma <rullzer@owncloud.com>
Wed, 3 Feb 2016 10:28:07 +0000 (11:28 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Wed, 3 Feb 2016 10:28:07 +0000 (11:28 +0100)
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

core/js/js.js

index bc8c51e40d3616a66cacccfb4beb1b3baf2d87b0..83658a537b8fe5254cdef430a0cd2a1299b61e74 100644 (file)
@@ -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
         */
@@ -253,6 +259,17 @@ var OC={
                return window.location.host;
        },
 
+       /**
+        * 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
         *