-
Bug
-
Resolution: Fixed
-
Normal
-
9.6.0
-
Security Level: Jimmy
-
None
Steps to Reproduce
Run download in ZK embedded application
Current Result
Download is performed on the outer application's context
(if the main website https://myapp/ is embedding https://mzkapp/, the download url will looks like https://myapp/zkau/.../myfile.txt instead of https://mzkyapp/zkau/.../myfile.txt)
fails with 404 since file doesn't exist on the outer webapp
Expected Result
Calling Filedownload.save(media) downloads the media, even in embedded app
Debug Information
Workaround
function retrieveZkUrlContext(){ if(!zEmbedded || !zEmbedded._zk_loadedResource){ return; } var resource = Object.keys(zEmbedded._zk_loadedResource)[0]; return resource.split("zkau")[0]; } zk.afterLoad("zk", function () { var _xcmd0 = {}; zk.override(zAu.cmd0, _xcmd0, { download: function(url) { var newUrl = null; if( retrieveZkUrlContext()){ newUrl = retrieveZkUrlContext() + "zkau" + url.split("zkau")[1]; } else{ newUrl = url; } var result = _xcmd0.download.apply(this, [newUrl]); return result; } }); });
- relates to
-
ZK-4924 Provide an API to rewrite a relative url to an absolute url in embedding context
- Closed