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

HTML

Web Server for Remote Files?

Why do I need to run a web server (e.g. MAMP) to play video and audio files locally that come from a remote source?

The video and audio files are working just fine running them locally. I don't see why I have to run a web server. Nick Pettit mentioned something about same-origin policy. What does this mean?

Hi Zack,

Which video is this from and could you post your video markup that you're using?

It's from the video: 'The Video Element' (https://teamtreehouse.com/library/html-video-and-audio/media-basics/the-video-element) in the HTML Video and Audio course. It explains in the teacher notes...

I'm not sure. I tried it myself and it works.

I saw that you had asked this question earlier and tagged Nick. We can see if there's any response in that one.

1 Answer

this might help clarify-from MDN "The same-origin policy restricts how a document or script loaded from one origin can interact with a resource from another origin. Same-origin Policy is used as a means to prevent some of the Cross-site Request Forgery attacks."

https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

Thanks!