Click here to Skip to main content
13,085,292 members (54,579 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I have two pages
1. default.html
2. login.html

In application startup page is default.html. When run this page will open login.html with separate window(in my case will open the application in full view). At the same time default.html will reopen again and close immediately.

The following source is working fine in ie,chrome, safari. But It is not working in Firefox only.

<pre lang="xml"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <script type="text/javascript">
        function openWin() {
            var qry = window.document.location.href;
            var val = qry.indexOf("flag");
            if (val == -1) {
      "login.html", "Login");
                var selfwin ="default.html?flag=open", "_self");
<body onload="openWin();">


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <form id="frmlogin">
        Login Page</h4>
Posted 17-Jun-12 20:43pm
Updated 25-Jun-12 18:20pm
Shelby Robertson 19-Jun-12 10:20am
"At the same time default.html will reopen again and close immediately."

Why would you want it to reopen and then close? Why not just close?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You wrote:
var qry = window.document.location.href;

W3schools says
The location object is part of the window object and is accessed through the window.location property.
Note: There is no public standard that applies to the location object, but all major browsers support it.

See their first sentence. You should try
var qry = window.location.href;

P.T.R.K 5-Jul-12 8:22am
I tried still it will not work in FireFox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100