...

/

Cross-origin Resource Sharing

Cross-origin Resource Sharing

Protecting your website's resources from other domains is important! Let's see why in this lesson.

Problem: your money gets stolen online!

Imagine you are checking your bank balance via your bank’s website. Meanwhile, you open a blogging website in another tab. You finish with the blogging website and come back to your banking website. You notice that your account balance has been wiped clean! All the money went away after you opened that blogging website! What could have happened?

svg viewer

The cause

So, it turns out that the blogging website had sent an HTTP request to your banking website for a funds transfer. When a website can access a resource or execute commands on another domain via HTTP requests, the process is called cross-origin resource sharing. This is a problem because it can be abused, like in the case above. So, ...