Connect with Facebook   
    Home  |   Learn AJAX  |   Forum  |    Register  |    Submit Resource  |   Submit Article   |   Contact Us
 

JavaScript

Home JavaScript

JavaScript Redirection

Category: JavaScript   |   Comments (0)

Redirecting users is often a task needed by web developers in order to maintain familiarity among users. For example, developers can simply redirect users to the new website instead of pushing for a different web address. Through this technique, developers can maintain familiarity with their users while providing significant development to their online application.


Sponsored Links
 

 


Just like most web development languages, JavaScript offers a smart and easy way on how to redirect users to the preferred webpage. This function can be considered as a standalone function so the new webpage does not have to be based on JavaScript or Ajax.


Client Side Redirection


Before delving into client side redirection of JavaScript, it should be noted that redirection cannot be done without any interaction with the server. That means, the idea of "client side" redirection is basically based on the behavior of JavaScript. Redirection using JavaScript will always require some interaction with the server.


With that said, client side redirection through JavaScript is an exchange of information from the client to the server side. The process starts with the user requesting for a webpage (client side) which is redirected to the server (server side). The response is sent to the client side (client side) and this response contains the new address. Information is again sent to the server side to grab the new webpage (server side) and the new page will be displayed on the browser (client side).


In gist, the process goes this way: client, server, client, server, client.


Advantage and Disadvantage of the Client Side Technique


Using this technique, developers will be able to optimize the bandwidth connection between client and server. With a powerful internet connection, redirection will be fast. Functions will also be installed in the old and the new webpage which means no information from the new webpage is displayed yet.


On the other hand, redirection could easily take its toll on the browser because of the required bandwidth. If the gadget is not optimized for JavaScript, there is a possibility that the new webpage will not load with the expected speed.


The PHP Option


On the other hand, developers can choose to use a "server-side" based redirection. The most popular programming language used for redirection is PHP. By using PHP, developers will be able to explore a small part of the webpage to easily stream online.


PHP is almost the same compared to the client side redirection. But the key difference is that the client side will require the webpage header in order for the right webpage to be implemented in the client side. Instead of using a variety of functions, PHP simply asks the server to provide the header.


The main advantage of this technique is that it can be easily implemented in any browser because of the compatibility with PHP. On the other hand, it will have the same problem with bandwidth requirement because it will try to locate the header.



Sponsored Links
 

 

JavaScript or PHP based redirection are considered even in terms of technique. Developers just have to determine what works best for their users.



Read Next: Implementing SVG in JavaScript


 
Post Your Comment
Members - Please Click here Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification:
 
 Subscribe    

Post Your Comment via FaceBook

Connect with Facebook



 
Comments
 
 
 
 

Sponsored Links

 

Copyright © 2005 - 2010 AjaxWith.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape