jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

Hidden iframe being removed by Angular #80

Closed ghost closed 10 years ago

ghost commented 10 years ago

I am using this plugin in AngularJS and is having problems in Chrome when navigating from one page to another, is basically loading the full html into the body including the head and scripts.

I am using ui-view of angularjs.

jpillora commented 10 years ago

That sounds like it will remove the iframe that xdomain creates. Can you do something like

<body>
<container ng-view>
</container>
</body>

?

ghost commented 10 years ago

I tried it and it worked but i'm using ui-router which uses ui-view and I want to use this

jpillora commented 10 years ago

I'm closing this because, although I could detect the missing iframe and recreate it, doing so over and over is inefficient and would slow down XHR a great deal. The better solution is to find a way to make your <body> replacing library, Angular or whichever, instead replace a <conatiner> as mentioned above.