Monday, 13 May 2013

Hiding address bar in pop up window using Javascript.

Hello guys


I was working on my project, and found out that all the latest browser's does not allow the hiding of Address bar( The URL display).
Here's my code:


<html>
<head></head>
<body>
<a href="http://localhost:8080/webSMA/WebManagement.html" onclick="window.open(this.href,'child','width=796,height=610,status=no,directories=no,menubar=no,toolbar=no,scrollbars=no,location=no,resizable=no,titlebar=no'); return false"><button type="button">WebManager EndPoint Editor</button></a>
</body>
</html>

PROBLEM

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.
It works Fine in Internet explorer.
The problem with firefox, i figured out is the security issue. It ignores all the Javascript related to the
"Location= no and Resize=no" part.

SOLUTION

If you want to hide the address bar then,

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.


6 comments:

  1. i think the location=no is also not working on chrome right?

    ReplyDelete
  2. it is not working . still address bar is showing . please give me solution

    ReplyDelete
  3. It is Working in Chrome. still address bar is showing. Bt it is not working in firefox and Opera.
    Plzz help me

    ReplyDelete
  4. Hi Its fine...worked in firefox..but cant worked in chrome and IE..suggest pls

    ReplyDelete