?
Solved

javascript popup problems in Opera

Posted on 2003-03-06
16
Medium Priority
?
536 Views
Last Modified: 2008-02-01
I am trying to popup a window in opera.  I have a code that will work, BUT in opera, I cannot get it to popup using the toolbar feature.  A sample of my code is here: http://www.wosnetworks.com/opera/knowbase.htm .  It works in IE but not in Opera.  When it pops up in opera, it will not pop up with anything.  Thanks!

--Frank
0
Comment
Question by:FrankOwen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 2
  • +2
16 Comments
 
LVL 4

Expert Comment

by:jonnal
ID: 8083915
hi couple of things to try

1 try buliding the string and using a var in the attributes place eg
var atts = "blahblah"
window.open('main.htm', 'Test',atts);
test that with a alert to see if your attributes are ok.

2 maybe in opera one of the screen attributes is not a keyword and is putting "left=undefined" as an attribute
test that with a alert.

0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8084376
I am quoting what I think is your code below if that is true, then you will need to change your window.open code to the following:

    window.open('main.htm', 'Test', 'toolbar=yes,scrollbars=yes,top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);  

Fritz the Blank


<html>
<head>
<title>Knowledge Base - v3.0</title>
<script>

function MM_callJS(jsStr) {
  return eval(jsStr)
}

     winwidth = 769; // width of the new window
     winheight = 400; // height of the new window
     winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
     wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom
     

     window.open('main.htm', 'Test', 'toolbar,scrollbars,top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);  

</script>
</head>

<body onLoad="MM_callJS('window.close()')">
</body>
</html>
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8084392
Here is how I do that:

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
function newWindow(strWin,strURL,intX,intY,intWidth,intHeight){
strWin =window.open(strURL,strWin,'top=' + intX + ', screenX =' + intX + ', left=' + intY + ', screenY=' + intY + ', width=' + intWidth + ', height=' + intHeight + ', scrollbars=yes, toolbar=yes');
}

//-->
</SCRIPT>

</HEAD>
<BODY>
<form>
<INPUT type="button" value="Open Window" name=button1 onClick=newWindow('wndFairCon','http://www.FairfieldConsulting.com',200,0,600,480)>
<form>
</BODY>
</HTML>


Fritz the Blank
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 5

Expert Comment

by:kasandra
ID: 8086654
When I tested the above page in IE6, I got two windows - one with the message that "the web page you are viewing is trying to close the window" (when I click yes, it closes). The other window gives an HTTP 404 error.

When testing it in Opera 7, I just get the window with the HTTP 404 error - I assume the window.close on the other window worked without asking the user if it was ok..?
0
 

Author Comment

by:FrankOwen
ID: 8088746
kasandra,
    That is another issue that is puzzling me......

    When I tested the code I have the same outcome with ie6, but in opera, when it closes the window it doesnt just leave the pop up, it leaves the opera 7 program up also which it did not do in earlier versions.

--Frank
0
 

Author Comment

by:FrankOwen
ID: 8088768
Woppse, just read the other post about window.close and opera....... :-)
0
 

Author Comment

by:FrankOwen
ID: 8088786
Fritz,
    That code works perfectly in IE, but it does not work in opera.

--Frank
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8088806
So, the toolbar=yes did not fix it?

Fritz the Blank
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8088814
BTW, you aren't supposed to be able to close the main browser window without a warning--that is by design. There is a bug that you can exploit to handle this issue, but EE has requested that it not be circulated for the very good reason that it great potential for abuse.

Fritz the Blank
0
 

Author Comment

by:FrankOwen
ID: 8088837
no, the toolbar=yes works in IE but not in opera.  Thats how my i wrote my code originally.
0
 

Author Comment

by:FrankOwen
ID: 8088844
That Sucks :-)  I am building this website for internal users, and some users are restricted to the internet.  I cannot give this website to them without finding a way to close the java script window so they cannot get access to the net.  

I saw someone say that it was possible by changing a setting in the users internet explorer, but I cannot find that setting.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8088874
So is the idea here that you will open the main browser, use that to lauch a pop up with out an address bar, and then close the main window?

Fritz the Blank
0
 

Author Comment

by:FrankOwen
ID: 8088921
That is correct.....so they never have access to the main browser....  If I can get that to work, I will not need opera :-)  which is a good thing
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 2000 total points
ID: 8088982
The best solution would be to set the network settings so that certain users cannot get access outside...if that is not going to work, drop me a line at the address in my profile, and perhaps we can brainstorm a solution.

Fritz the Blank
0
 
LVL 1

Expert Comment

by:DeeperDarker
ID: 8094062
trying to stop users accessing the internet by controling the browser is stupid, unless you can garantee (sp.) that all users are technically ignorant.

use a firewall, much easier, garanteed to work with all browsers.
0
 
LVL 1

Expert Comment

by:DeeperDarker
ID: 8094074
addendum:  change all the shortcuts on their boxes, and homepages, so it is hard to avoid your redirect page.

ban *.url files (a type of windows shortcut for web resources)
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question