Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Wenyang Li
Wenyang Li
4,453 Points

Why I can't access my angularjs page using ui-router by using domain name as url?

I was learning and making an Angularjs page with using ui-router, I uploaded the page to the server, this page is on the url http://139.162.63.75/share_mobile_page/#/webservice/1, and the page was working fine. However, I wanted to go to this page by domain name. I had map the "http://www.ostone.com.au" to the ip "http://139.162.63.75", and I hope to use http://www.ostone.com.au/share_mobile_page/#/webservice/1 to access the same page, but it had error: "/share_mobile_page/#/taskDetails/156:1 XMLHttpRequest cannot load http://139.162.63.75/share_mobile_page/views/taskDetail.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.ostone.com.au' is therefore not allowed access." I also tried to access another angularjs page without using ui-router, then I can access the page through domain name. Can any one help? Thanks

1 Answer

Inge L
Inge L
30,058 Points

You're limited by the same origin policy. Browser blocking cross-domain request. Read about CORS