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


#1

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.


#2

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


#3

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


#4

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.


#5

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"
        }
      }
    })

#6

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.


#7

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


#8

Hi

Any update on this ?

Regards

Vaibhav