Friday, December 11, 2009

Changing the default browser in Visual Studio

I’ve seen a few people ask if it is possible to change what browser is launched and used when running web apps in VS 2005 and Visual Web Developer (for example: to use FireFox instead of IE). The good news is that there is an easy way to configure this. To-do this:

1) Right click on a .aspx page in your solution explorer

2) Select the “browse with” context menu option

3) In the dialog you can select or add a browser. If you want Firefox in the list, click “add” and point to the firefox.exe filename

4) Click the “Set as Default” button to make this the default browser when you run any page on the site.

Note that there is also an optional drop-down at the bottom of the dialog that lets you select the default browser window size when loading. You can choose 800×600 or 1024×768 if you want to visualize what the site will look like for people using those screen resolutions. This works for both IE and FireFox (and probably other browsers too — those just happened to be the two I checked).

Hope this helps,
Waqar Ahmad

Tuesday, November 17, 2009

Restricting HTML or Javascript tags in input

following is javascript to restrict HTML or javascript tags in input.

function RestrictTags()
{
txt_box=document.getElementsByTagName('INPUT');
for (txt_0=0; txt_0 < type="="'text')" str1="parseInt(txt_box[txt_0].value.indexOf('<'))" str2="parseInt(txt_box[txt_0].value.indexOf('">'))
if (str1 >= 0 || str2 >= 0 )
{
alert("HTML or JavaScript tags are not allowed");
txt_box[txt_0].value='';
txt_box[txt_0].focus();
return false;
}
}
return true;
}