# Capacitor 5, How get localfiles assets on Capacitor/IOS

**URL:** <https://forum.ionicframework.com/t/capacitor-5-how-get-localfiles-assets-on-capacitor-ios/238611>\
**Category:** Capacitor\
**Created:** [December 21, 2023, 10:08pm UTC](https://forum.ionicframework.com/t/capacitor-5-how-get-localfiles-assets-on-capacitor-ios/238611 "2023-12-21T22:08:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlbertoVillegasR](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@AlbertoVillegasR](https://forum.ionicframework.com/u/AlbertoVillegasR)\
**Post date:** [December 21, 2023, 10:08pm UTC](https://forum.ionicframework.com/t/capacitor-5-how-get-localfiles-assets-on-capacitor-ios/238611/1 "2023-12-21T22:08:51Z")

</div>

Hi, community!  
How get assets local on capacitor/ios with HttpClient Angular?  
URL in image  
Environment:

- Capacitor 5
- Angular 16

```auto
  public myGet(
    url: string,
    hideLoader = false,
    errorHandler?: (err: any, caught: Observable<any>) => ObservableInput<{}>,
    responsive = null
  ): Observable<any> {
    if (!hideLoader) {
      this.events.publish('loading:start');
    }
    return this.httpClient.get(url, options).pipe(
      map((response) => response),
      catchError(errorHandler ? errorHandler : this.handleError),
      finalize(() => {
        if (!hideLoader) {
          this.events.publish('loading:finish');
        }
      })
    );

```

 ![Captura de pantalla 2023-12-21 094923](https://global.discourse-cdn.com/ionicframework/original/3X/a/9/a9d2900f638800b963ced54ec64f12cb152d0517.png)  
In Web && Android This working fine!

I’m Try transform url adding: capacitor://localhost:/assets…, but notworking  
Try Using CapacitorHttp but have this errors:

 ![Captura de pantalla 2023-12-19 130143](https://global.discourse-cdn.com/ionicframework/original/3X/6/2/6241bac890d61a8e8a2ddaae81bac04f7382abdd.png)

CapacitorConfig:

```auto
const config: CapacitorConfig = {
  appId: 'example.app',
  appName: 'App',
  webDir: '../../dist/apps/app',
  server: {
    cleartext: true
  },
  bundledWebRuntime: false,
  plugins: {
    CapacitorCookies: {
      enabled: true
    },
    CapacitorHttp: {
      enabled: true
    },
    PushNotifications: {
      presentationOptions: ['badge', 'sound', 'alert']
    },
    SplashScreen: {
      launchShowDuration: 2000,
      backgroundColor: '#79c000',
      showSpinner: false,
      splashFullScreen: true,
      splashImmersive: true
      // layoutName: "launch_screen",
      // useDialog: true
    }
  }
};

```

---

<div class="post-metadata">

**Author:** ![AlbertoVillegasR](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@AlbertoVillegasR](https://forum.ionicframework.com/u/AlbertoVillegasR)\
**Post date:** [December 22, 2023, 10:59pm UTC](https://forum.ionicframework.com/t/capacitor-5-how-get-localfiles-assets-on-capacitor-ios/238611/2 "2023-12-22T22:59:03Z")

</div>

Hi solution is:  
To not move the code (of an application already made).  
It is better to make it an interceptor and have it redirect.

```auto
if(this.platform.is("ios") && url.include("assets")){

const baseHref = window.location.origin + '/' + url;
 fetch(baseHref).then(async (res) => {
        const data = await res.json();
        return data;
      })
}

```

This windows.location.origin = capacitor://localhost/…  
PD:  
Not working in android for hostname localhost
