Link cloaking is a method to replace a long URL in the browser address bar with the short one. For example, the link like "https://www.youtube.com/watch?v=Bor_3vxnJPI/?utm_source=twitter" is replaced with "https://yourdomain.com/video". The feature's purpose is to hide possibly important parts of links like UTM parameters, affiliate code.
The most frequently cloaked websites among Short.io users are:
- Google Datastudio.
- Google Docs.
- Google Spreadsheets.
- Amazon S3.
If you are trying to cloak links with these services, the error "Cloaking is forbidden by destination URL with X-Frame-Options header" may occur. The main reason for its inception was to provide clickjacking protection. This includes a page rendering in a frame, iframe, or object. Iframes are used to embed and isolate third-party content into a website.
YouTube is one of the websites that forbids link cloaking. Sometimes you inevitably need to hide youtube links because of the important information behind it.
Go to the video you want to cloak.
Copy embed code
- Extract the link from the embed code from the src value.
iframe width="1280" height="692" src="https://www.youtube.com/embed/Bor_3vxnJPI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
- Shorten the link.
This way, the link will be shortened, and you will successfully hide important values.
What did you learn?
- link cloaking is forbidden
- x-frame error
- how to hide links