Change Status bar message using JavaScript

on December 03, 2010 0 comments
  
JavaScript can be used to display messages in the status bar using window.status. For example, you can display a javascript status bar message whenever your users hover over your hyperlinks.

To do this, use the following code:
<a href="status.html"
  onMouseover="JavaScript:window.status='Status Bar Message goes here'; return true"
  onMouseout="JavaScript:window.status=''; return true">Hover over me!</a>

Doesn't Work for You?

Most (newer) major browsers disable status bar messages by default. If your status bar doesn't change when you hover over the link, it's probably because of this. You can enable status bar messages by changing your browser settings as shown below,

In Firefox:
  1. Go to Tools > Options
  2. Click the Content tab
  3. Ensure that the JavaScript option is checked
  4. Click Advanced (next to the Enable JavaScript option)
  5. Check the Change status bar text option
  6. Click OK to save this screen
  7. Click OK again
In Internet Explorer:
  1. Go to Tools > Internet Options
  2. Click the Security tab
  3. Ensure that the Internet option is selected/highlighted
  4. Click Custom Level... (this launches the security settings for the Internet zone)
  5. Scroll down until you see Allow status bar updates via script (under the Scripting option). Click Enable
  6. Click OK to save this screen
  7. Click OK again
Note that, because this is the default setting in most browsers, there's a good chance that most of your users won't see your status bar message.
  

How to hide addressbar using Javascript in Firefox

on December 01, 2010 4 comments

Many of us are aware of how to open a popup window using javascript. The below code can be used to open a pop-up window using javascript,

<a href="#" onclick="window.open('pop.html','Popup','width=800,height=600,status=no,toolbar=no,
location=no,menubar=no');">Click</a>

When we use window.open() to create new browser windows have the option of specifying which chrome features appear on the window (menu bars, toolbars, the status bar, etc.) and what window functionality is present (whether it’s resizable, whether it has scrollbars, etc.).

The above code will work properly in all browsers except Firefox. Because hiding the locationbar is disabled by default in Firefox3(and later versions) due to security reasons.

We can hide/show the addressbar in Firefox by setting the below preference,
      Dom.disable_window_open_feature.location

Below are the possible values for this preference and their effects,
True:
Ignore "location=no" in the window features argument of window.open() and prevent popups from hiding the Location Bar. (Default in Firefox 3 and later versions)

False:
Allow popups to hide the Location Bar. (Default in Mozilla Suite/SeaMonkey and prior to Firefox 3)

You can modify this preference in two ways, about:config or user.js file. The below method shows how to change this preference using about:config option,

1) Type ‘about:config’ into the address bar and press enter
2) Filter for ‘dom’
3) Set ‘Dom.disable_window_open_feature.location‘ to false

There are also a bunch of other DOM options such as stopping new windows from opening with out the menubar (Dom.disable_window_open_feature.menubar), scrollbars (Dom.disable_window_open_feature.scrollbars) and such. You can find them here.