A line in config.xml gets always overwritten

Hi everyone!

I’m facing an issue, when I try to change a parameter of the config.xml, this one is always overwritten after a build.

To be more precise, I try to replace this default line:

<content src="index.html" />

by this line:
<content src="http://192.168.xx.xx:8100/#/home" original-src="index.html" />

Do you have an advice to fix that and to permanently modify this parameter?

For your information, I make a “ionic serve” on a Windows and I want to manage both Android and iOS devices at the same time. It’s like a “ionic run android -lc”, but for multiple devices.

Thank you,

Which config.xml file are you messing with?
How do you “build”? Which command do you execute?[quote=“Sneko, post:1, topic:89180”]
For your information, I make a “ionic serve” on a Windows and I want to manage both Android and iOS devices at the same time. It’s like a “ionic run android -lc”, but for multiple devices.

Ok, this doesn’t make any sense to me at all. Could you try to explain this with different words?

Sorry if I explained myself badly, I will try to be more precise :

  • The config.xml is located at the root of the project.
  • I build the project simply with : “ionic run ios”

And for the context :

I’m developing an application for Android and iOS devices, but I just have a Windows PC, an Android, and an iPhone to do it. To deal with my iPhone I have installed a virtualized MacOS with VMware and everything work well. (I mean I can build Android project on my Windows and iOS project on the MacOS)

But the problem is that the virtualized OS drains a lot of my laptop power… So I would like to be able to see changes with livereload on my both devices while running just one dev server on my Windows PC.

So my idea is to change the location.href of my built app. For that I’m trying to change

<content src="index.html" />

by this line:
<content src="http://192.168.xx.xx:8100/#/home" original-src="index.html" />

But the line is always replaced by the first one after a build.

Please tell me if you need more information or if you know a better solution :slight_smile:

So [quote=“Sneko, post:3, topic:89180”]
is a version of our app with livereload enabled?

Isn’t it then not enough to build the iOS app once, install it and then not to care if the line is overwritten as you still have the same app installed on iOS?

is the app launched by a “ionic serve”, so yes with livereload.

I see what you mean but each time I add/remove a plugin or a “native” parameter I need to rebuild the app. I know that plugins list in the config.xml and other parameters like splash/icons images aren’t replaced. So I was wondering why my content attribute is always replaced and how to make it remaining despite the builds :worried:

1 Like

It seems that the element can’t have an attribute original-src="http://192.168.xx.xx:8100" for a iOS build (otherwise the builder will replace it with the default one). But it works fine for Android.

So for iOS, instead of having :
<content original-src="index.html" src="http://192.168.xx.xx:8100" />

Just simply put :
<content src="http://192.168.xx.xx:8100" />

And for those who are interested in having a remote dev server like me, the command ionic serve can’t manage the cordova plugins, your app would be like a basic browser… To fix it, you should instead add some parameters to simulate the basic livereload (may not all of them are required):
ionic serve --runLivereload --isPlatformServe --consolelogs --livereload --iscordovaserve --nobrowser

One last thing, even if you are on Windows PC with all the plugins, don’t forget to make a ionic platform add ios otherwise the built app won’t initialize plugins.

That’s it! I hope it could help someone :wink:

Thanks for all Ionic team :smiley: :smiley: :smiley: !

This behaviour is annoying - we have a team working on this app, and this line (not to mention the other <allow-navigation ...> tags) gets automatically modified and version-tracked when each developer works on the app.


Can you suggest another solution? (Honest question, I was wondering about that myself)

“Solution”: Make developer aware not to check this line change in.

The <allow-navigation> tags allow wildcards - does the <content> tag support this too? Haven’t tested yet.

The problem with wildcards is that while the wildcard line stayed, other lines were still added for each IP address.

<content> tells the app which exact file to load and show - wildcards can’t work there :confused:

Hi, did you find a solution?
Because this is still happening 4 yeras later!!
I’ve been working with this project for 2 weeks, and I’ve never ever has any problem about this, magically it’s happening, and it’s like W*F
I’m working with ionic6