How can we switch browsing between remote website and local html pages into ionic app

I have requirement to load some of the pages locally that will download with the app but after longing i wants to load my server ionic website pages.

How can i load remote url within ionic app.Is there any predefined rule for that.

You should be able to reference them by using their address AFAIK. The only thing you may need to do is whitelist their urls in your config set up

thanks …but i could not understand here what you are suggesting …could you please explain in detail.

Hey,
look here:
https://docs.angularjs.org/api/ng/provider/$compileProvider:
aHrefSanitizationWhitelist
imgSrcSanitizationWhitelist

And for “unsafe” html-snippets:
https://docs.angularjs.org/api/ngSanitize/service/$sanitize

Greetz.

1 Like

That and you should be able to specify a template like so…

.state('eventmenu.home', {
      url: "/home",
      views: {
        'menuContent' :{
          templateUrl: "http://example.com/templates/home.html"
        }
      }
    })

thanks its working… but for coming back to local page again we have to write code in native file or we have same option in angular state like
file:///android_asset/www/Index.html

.state('index', {
      url: "/index",
      views: {
        'menuContent' :{
          templateUrl: "file:///android_asset/www/Index.html"
        }
      }
    })

I tried it but its not working…getting Error

XMLHttpRequest cannot load file:///android_asset/www/index.html. Cross origin requests are only supported for HTTP

how can we coming back to local page again.

yes the same problem here i am getting .is there any update on this

Hi

Any update on this ?

Regards

Vaibhav