[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)

James Yong-2
This is an automated email from the ASF dual-hosted git repository.

jamesyong pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 0c2c3d4  Improved: Move page-specific script links to html template (OFBIZ-11799)
0c2c3d4 is described below

commit 0c2c3d4cb92e8e0b9ca7245ed45aea9c63ecc730
Author: James Yong <[hidden email]>
AuthorDate: Mon Aug 17 13:02:41 2020 +0800

    Improved: Move page-specific script links to html template (OFBIZ-11799)
   
    importLibrary function to check for local environment before setting crossDomain.
---
 themes/common-theme/webapp/common/js/util/OfbizUtil.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js
index bb9da1b..c08d60d 100644
--- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js
+++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js
@@ -1434,7 +1434,7 @@ var importLibrary = function() {
         function cachedScript(url, options) {
             // Allow user to set any option except for following
             options = $.extend(options || {}, {
-                crossDomain: true, // set to true to allow the file to be shown under browser's sources folder
+                crossDomain: isLocalEnviron(), // when true, file is shown under browser's sources folder
                 dataType: "script",
                 cache: true,
                 url: url
@@ -1467,4 +1467,8 @@ var importLibrary = function() {
             alert('Error loading one of the files: \n' + urls.join('\n'))
         });
     }
-}();
\ No newline at end of file
+}();
+
+function isLocalEnviron(){
+    return ["localhost","127.0.0.1"].includes(window.location.hostname);
+}
\ No newline at end of file