# Introduction In this lab, we will explore how to check if two URLs are on the same origin using JavaScript. We will use the `URL.protocol` and `URL.host` properties to compare the protocol and host of the URLs and determine whether they belong to the same origin or not. This is a useful skill for web developers who need to ensure the security of their web applications and prevent cross-site scripting attacks.
Click the virtual machine below to start practicing