08.27.08

To Disable cut,copy,scroll in IE Browser

Posted in Browser Stuffs at 7:26 am by meetravi

<html>
<body ondragstart=”return false” onselectstart=”return false”>
hii.Try selecting or dragggin the text .ain’t it possible rite???? ha ha ha
</body>
</html>

To Disable a Back button in browser

Posted in Browser Stuffs at 6:46 am by meetravi

You can insert this code in all your pages:

<SCRIPT>
<!--
javascript:window.history.forward(1);
//-->
</SCRIPT>

Browser FAQ’s

Posted in Technology at 6:41 am by meetravi

Check browser properties

Q: Can I check whether Java is enabled in the browser?

A: The method to check whether Java is installed and enabled is navigator.javaEnabled(), which returns a boolean value.

Q: How can I get the operating system the browser is using?

A: You can read the application version of the browser that executes your Javascript code from the navigator.appVersion property. This string is part of the user agent identifier that the browser sends to a server when it requests a Web resource and usually includes the browser version number and an indication of the operating system the browser is running on.

This property may be interesting purely for information, but you should be cautions about how you interpret its contents and avoid using it to control script execution. In many browsers, the user agent string can be modified to “spoof” as a different browser type, use arbitrary text or withhold any user agent information at all.

Controlling the browser

Q: Can I set the printer properties using Javascript?

A: No, the Javascript object model includes a window.print() method that may activate the standard print dialogue of a Web browser, but that is as far as the functionality extends. It would not be appropriate or safe for Javascript code to be able to check the printers attached to a computer, look up printer properties or arbitrarily configure their settings.

If you want to influence the way a Web page is printed, you will find it much more effective to use Cascading Style Sheets for print media. See the Media style sheets FAQ for further details.

Q: Can I select a particular printer using Javascript?

A: There is no DOM standard object reference to system printers and therefore no Javascript or ECMA script application programming interface for selecting amongst available printers. The basic DOM level 0 function for printing is window.print(), which should raise a print dialogue. Whether users have any printer attached to their computer, decide to choose amongst them and to commit the print job is outside the control of Javascript. It would be a security hazard if Web page scripts could arbitrarily control computer peripherals and expend paper and ink without user intervention.

Q: Is there a method to clear the browser cache?

A: It should not be possible to clear a browser cache using Javascript because this would be a security hazard.

Q: Is there any way to enable Javascript if it is off?

A: There is no way to switch on Javascript in a Web browser if it is not enabled. It would be a serious security hazard if code in Web pages could override users’ browser settings in this way.

People choose to switch off Javascript because some Web developers mis-use Javascript to affect the way their browser works; typically with pop-up windows and redirects to pages they have not chosen to visit. Some Web browsers do not support Javascript at all, so your Web pages should be designed to provide useful information for people without Javascript.

Locking down the browser

Q: How can I suppress the print dialogue?

A: It is always a bad idea to try to stop people’s Web browsers working the way they expect. There are very good reasons for a print dialogue to be shown; so that it can be cancelled in case print was requested by mistake, so that the settings can be adjusted as required for the content, so a different printer can be selected. Can you be sure they actually have a printer connected?

You should re-consider why you want to disable the print dialogue and perhaps provide more guidance to the user about what you would like them to do. The media dependent style sheet FAQ may give you some further ideas.

Q: How can I suppress Ctrl+N for new window?

A: It is never a good idea to stop people’s software from working the way they expect it too. You should re-think why you would want to do this. If there is some shortcoming in your application design? Don’t try to break your users’ Web browsers to work around it, they will not thank you for it.

The Ctrl-N keyboard combination is probably one of the least commonly known ways to open a new Web browser window and there are several more obvious ways to do so anyway.

Q: How do you disable view source and save image options?

A: It is never a good idea to stop people’s browsers working the way they should and you should look again at why you want to stop them doing things that are fundamental to the Web. There are techniques that can make these operations difficult, but they can be overcome simply by switching off Javascript in the Web browser or using a different client.

Any efforts to stop people taking copies of content that is published on a public Web address are futile and likely to impair the usability of your site. If you do not want to risk the possibility that people will take copies of your source code and images, do not publish them on the Web or find a different way to achieve your goals.

Q: How do I disable the “Save As” option in IE using Javascript?

A: This is another example of something you should not attempt to do with Javascript, it is never a good idea to try to prevent a person’s browser working the way it is intended, some would regard it quite hostile. In this case, the objective is completely futile; any HTML, image, Javascript or CSS that is published on the Web is completely in the open and can be saved in numerous ways. In most cases Web resources are immediately saved in the browser cache.

If you are trying to protect a digital resource that is truly valuable, you should not make it available on the Internet.

Q: Can I use Javascript to disable the browser cache?

A: It is not possible or desirable for Javascript code on a Web page to disable fundamental browser features such as URL resource caching. You should re-think the issue you are facing and consider a different way to tackle it. For example, you can set HTTP headers to request resources are not cached, and that cached resources are refreshed after a specific period, or that the freshness of cached resources is checked before re-loading a page. Web user agents are not obliged to follow these directives, but most will be configured to do so. See the Site manager FAQ for cache configuration examples related to stylesheets.