Monthly Archives: June 2013

Redirect user to another page via jQuery or Javascript

There are several methods to redirect user to another page. Here I will explain snippet code of jQuery and JavaScript to redirect user from one to another web page.

Location Object

Using location object you can redirect user to another page. Copy below code and paste it in Firefox or Chrome console and see there are several things you can do via location object.

console.log(location);

In the above snap shot you can see href attributes. Yes, we will use location.href to redirect user to another web page.

location.href with jQuery

jQuery(location).attr(“href”,”newpage.htm”);

That’s it with jQuery. Put above snippet in your function.

function fun_redirect(){
jQuery(location).attr(“href”,”newpage.htm”);
}

location.href with JavaScript

var hrefUrl = ‘newpage.htm’;
window.location.href = hrefUrl;

or

var hrefUrl = ‘newpage.htm’;
window.location = hrefUrl;

using above method we can redirect user to another web page using jQuery or JavaScript.

 

HTML TABINDEX

Recently, I have been working with one of the client and first time get experience of oldest HTML future. Let me tell you whole things.

Some months ago client sent email to me.

Please find attachments of our systems. I want everything as it is. The only change is that change it desktop to web.

That’s it.

We have started to building application one by one. Completed all phase (Analysis, design, coding and testing) then deliver to client. Important thing is we have done testing with client also. Everything works good and smoothly.

After couple of days get another email from same client.

Hey Guys, There is a big buuuuuuuuuuuuuuuuuuuuuuuuuuuuuug in a system.

We have tested again whole system by end user as well. Everything works fine. All calculations, reports everything. But client says there is a bug in a system then arrange meeting with client and says look in our old system the cursor move step by step on object that we need and it’s not in new one so how can we work? Then said OMG we never notice this point. OK don’t worry we will do.

Using TABINDEX Attributes we have set up whole step and client gets happy. :)

So I experienced about TABINDEX very first time in my programming life.

DEMO

[cc lang=”html”]

1 TABINDEX : 1
2 TABINDEX : 5
3 Anchor Tag TABINDEX : 2
4 TABINDEX : 7
5 TABINDEX : 3
6 TABINDEX : 4
7 TABINDEX : 6

[/cc]