Create Custom Redirect Using Meta Tag and JavaScript

The custom redirect will redirect your blog to a new address, it’s an simple tag that can be placed anywhere in the HTML or php file. The redirect meta tag uses refresh feature, which means it’ll refresh the page on which page the code is placed. The time is customizable by the user.
This tag can be placed by the structure below

<meta http-equiv="refresh" content="01;http://www.yourwebsite.com" />
<head>
<title>Gadget Ninja - Technology and How-To Guides</title>
<meta http-equiv="refresh" content="01;http://www.yourwebsite.com" />

This tag helps to webmaster when they are on free hosting sites which do not support the redirect option, and they created a new website where they wants to redirect their readers but can’t because free hosting services don’t offer the redirect option. At that time putting this tag will redirect your users to new address.This tag is simply known as html meta refresh tag.

If you using blogging platform like WordPress, then for creating redirects, I will suggest you to use Plugins like Redirection. This is mostly used when your site is having lot of 404 errors.

This tag gives order to the browsers, that you need to refresh this specific page in a specific time. The time interval can be changed by making change in the value, you can make it zero or any very low value.

There are some problems of this html meta refresh is that if the redirect is placed with a time interval of two or less than two seconds then a user will not be able to read the content and he’ll redirected to another page.The other drawback of this tag is that if a reader don’t wanted to be redirected and still if he redirects then your users will be dissatisfied.

Create Custom Redirect Using Meta Tag and JavaScript

The best part of using this tag is this is SEO friendly with search engines. As per my experience with meta refresh, if this tag is placed than google will crawl the new URL, instead of this it was crawling to the old one which was on free hosting and will place your new site at the place of your old site in google search.

If you don’t want to use this meta refresh then try the JavaScript redirect.

<body onload="window.location = 'http://example.com/'">

The problem with this code is this sometimes users disables the JavaScript to increase their internet speed and a result it will not redirect. Simply the user will be stucked on the page.

If you are on Blogspot platform and you want to redirect the blogspot to another blog,  then this Java code will make your work faster.

When any user hits your website from a non Java supported browser, then your site will not be refreshed, as it’s fully based on Java.

Author: Viral In India

This post was written by Gadget Ninja Staff.

2 thoughts on “Create Custom Redirect Using Meta Tag and JavaScript”

Comments are closed.