Search content within the blog

Wednesday, April 8, 2009

Redirecting to a page in the application if javascript is disabled

Sometimes the JavaScript may be disabled in the browser and your application may not perform or run in the desired way. so one of the ways to handle it will be to add the following lines in every page or best place is in the master page...

<noscript>
<meta http-equiv="REFRESH" content="0;URL=JavascriptDisabled.aspx" />
</noscript>

here noscript indicates if scripting function is disabled in the browser ....then we are redirecting to page called JavascriptDisabled.aspx .. the contents of that page are as follows....

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JavascriptDisabled.aspx.cs" Inherits="JavascriptDisabled" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Loobalee-Javascript Disabled</title>
</head>
<body bgcolor="Lightblue">
<form id="form1" runat="server">
<div>
<table style="top:750px" align="center" width="50%" border="1">
<tr>
<td style="color:White">
Javascript is disabled in your browser .Enable javascript.to revisit site after enabling <a href="Index.aspx">Click Here</a>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

No comments:

Post a Comment