diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/config.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/config.js
index 5c639fb9d29fb3bd8c0aa0bb2a8e5d4ea311e758..d07541fdce859db6fdb69a21cdf7517fd5d42928 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/config.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/config.js
@@ -1,9 +1,17 @@
 var require = (function() {
 
 	var getBaseUrl = function() {
-		var path = window.location.pathname;
-		var index = path.substr(1).indexOf("/") + 1;
-		var baseUrl = path.substring(0, index) + "/resources";
+		// To find where the V3 API has been loaded from we scan the script tags until finding this file
+		// This way is possible to load the V3 API from a separate domain
+		var scripts = document.getElementsByTagName("script");
+		var baseUrl = null;
+		for(var sIdx = 0; sIdx < scripts.length; sIdx++) {
+			var src = scripts[sIdx].src;
+			var substringEnd = -1;
+			if((substringEnd = src.indexOf("/api/v3/config.js")) > -1) {
+				baseUrl = src.substring(0, substringEnd+"/api/v3".length);
+			}
+		}
 		return baseUrl;
 	}