diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index b9797a732..eb3f239b5 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -539,6 +539,10 @@ export class CoreCourseHelperProvider { return this.downloadModuleWithMainFileIfNeeded(module, courseId, component, componentId, files, siteId) .then((result) => { if (result.path.indexOf('http') === 0) { + /* In iOS, if we use the same URL in embedded browser and background download then the download only + downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */ + result.path = result.path + '#moodlemobile-embedded'; + return this.utils.openOnlineFile(result.path).catch((error) => { // Error opening the file, some apps don't allow opening online files. if (!this.fileProvider.isAvailable()) { diff --git a/src/providers/file-helper.ts b/src/providers/file-helper.ts index 4bd5d3f37..79c76d1fc 100644 --- a/src/providers/file-helper.ts +++ b/src/providers/file-helper.ts @@ -56,6 +56,10 @@ export class CoreFileHelperProvider { } if (url.indexOf('http') === 0) { + /* In iOS, if we use the same URL in embedded browser and background download then the download only + downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */ + url = url + '#moodlemobile-embedded'; + return this.utils.openOnlineFile(url).catch((error) => { // Error opening the file, some apps don't allow opening online files. if (!this.fileProvider.isAvailable()) {