Some times we need to redirect our visitors to an other location, the following redirect code will
do redirection to any given webpage address, the syntax of JavaScript
Redirection is as under.
There are many reasons for using a redirect code within our web page. However, the most popular
reason is to redirect visitors to a new webpage when we've changed the location of the original
webpage. If we don't, our visitors will receive an error page, which will cause them to leave our
website and probably never return. Second major use of JavaScript redirection
can be, when some times our visitors fill the
HTML forms and after completion of form completion we redirect them to
welcome page and if fill-in form filled incorrectly then we redirect them to an
error page.
Another good reason to use a redirect code within a web page that has moved is the Search Engines.
When we create your web site and upload it to any web server, chances are, our pages will be quickly
indexed by the Search Engines, as many Search Engines continually crawl the Internet in search of new web
pages. If we don't use a redirect code to redirect our Search Engine visitors to our new web page,
we
may lose these visitors forever.
We can also redirect our visitors by
HTML meta tags but here
in this section of JavaScript Tutorial we will discus and explain only Redirection using JavaScript
the only over view for meta redirection is as under.
The above line of HTML Meta tag for redirection to a given URL works same like
JavaScript Redirection. Again it will keep our visitors in touch and just
forwarding them to a new location.
Note: When using redirect codes within our web page, please make sure we aren't using this
redirect code for unethical purposes, such as trying to trick the Search Engines into
for up ranking
your web page higher. This action could get our web site banned by search
engines. Please ensure to use only
ethical means in which to obtain web site traffic.