Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Firefox
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.
 
default.html
<pre lang="xml"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript">
        function openWin() {
            var qry = window.document.location.href;
            var val = qry.indexOf("flag");
            if (val == -1) {
                window.open("login.html", "Login");
                var selfwin = window.open("default.html?flag=open", "_self");
                selfwin.close();
            }
        }
    </script>
</head>
<body onload="openWin();">
</body>
</html>
</pre>
 

login.html
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
    <form id="frmlogin">
    <h4>
        Login Page</h4>
    </form>
</body>
</html>
 
Posted 17-Jun-12 21:43pm
Edited 25-Jun-12 19:20pm
v2
Comments
Shelby Robertson at 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
good
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;
 
Cheers,
Peter
  Permalink  
Comments
P.T.R.K at 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
0 OriginalGriff 304
1 Maciej Los 285
2 Sergey Alexandrovich Kryukov 255
3 Shweta N Mishra 216
4 PIEBALDconsult 174
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2014
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