Skip to content

About

Dedirects user to non-https sites. Can be used as an API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Simple Client-Side URL Redirector

📄 Overview

This project is a single-file, client-side HTML page designed to perform an immediate URL redirection based on a query parameter. It is useful for creating short, dynamic links or safely redirecting users after an action (like email confirmation) to a custom destination, potentially even using custom URL schemes (like mailto:// or upi://).

The script looks for the value of the url parameter in the current page's query string and immediately navigates the browser to that address.

🚀 How to Use

Target Action Example Link
Redirect to Youtube https://pver-programz.github.io/url-redirector/?url=https%3A%2F%2Fwww.youtube.com
Open a Mail Client https://pver-programz.github.io/url-redirector/?url=mailto%3Atest%40example.com
Redirect to a Google search https://yourdomain.com/redirect.html?url=https%3A%2F%2Fgoogle.com/search?q=github

Note: Always URL-encode the target URL, especially the colon (:) and forward slashes (/), to ensure it is correctly passed and decoded by the browser and the script.

🛠️ Implementation Details

The core logic is handled by the JavaScript function parseAndRedirect() which runs on the page's load event.

  1. Read Parameter: It uses new URLSearchParams(window.location.search) to extract the value of the url parameter.
  2. Decode: It calls decodeURIComponent(target) to resolve any URL encoding.
  3. Redirect: It sets window.location.href to the decoded URL, causing an immediate browser navigation.

The script includes basic error handling for missing or malformed url parameters.

Use this script with caution, understanding the security implications.

About

Dedirects user to non-https sites. Can be used as an API.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages