Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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