...

View Full Version : Opening Window in Javascript



BowBeforeRoot
12-25-2011, 12:23 AM
Hey Guys,

I feel like a complete idiot posting this, but I clearly am missing something. I'm trying to open a window with the specs below but all it does is open a standard sized window.

Any help would be greatly appreciated.



<SCRIPT LANGUAGE="javascript">
function open_window() {
window.open ('https://domain.com/document.php','newwindow',config='height=418,width=590,toolbar=no,menubar=no,scrollbars=no,resizable =no,location=no,directories=no,status=no')
}
</SCRIPT>

<p><a onclick="open_window()"><img src="images/image.png" width="142" height="113" /></a></p>

sunfighter
12-25-2011, 04:39 PM
Remove

config= and it should work. Remember most browsers can change the way a popup happens.

BowBeforeRoot
12-25-2011, 11:19 PM
Hi,

Thanks for the reply. I have used config= as you can see. Should I be using it differently?

Cheers

BowBeforeRoot
12-25-2011, 11:22 PM
Sorry, I see what you mean. i'll give that a try.

BowBeforeRoot
12-25-2011, 11:31 PM
Remove

config= and it should work. Remember most browsers can change the way a popup happens.

I tried this and it did not work, I got the same result. Any other ideas?

Cheers!

sunfighter
12-26-2011, 04:30 AM
As I said the browser has control. I use firefox with tab mix plus. I have to go in and ALLOW a popup, that's a window open with window.open to do that. In my case I normally have it FORCED to open in a separate tag, in which case all the controls for scroll bars etc. are not listened to. I had to shut this off to allow the window you wanted to open.

Check your browser settings. What browser are you using?

BowBeforeRoot
12-26-2011, 06:15 AM
As I said the browser has control. I use firefox with tab mix plus. I have to go in and ALLOW a popup, that's a window open with window.open to do that. In my case I normally have it FORCED to open in a separate tag, in which case all the controls for scroll bars etc. are not listened to. I had to shut this off to allow the window you wanted to open.

Check your browser settings. What browser are you using?

Tested on IE, Firefox, and Chrome. Same result, just a standard window.

sunfighter
12-26-2011, 04:08 PM
Tested on IE, Firefox, Chrome, and Opera. All worked after making option changes to allow popups. Here's the code, notice https://domain.com/document.php does not exist so I used one of my own internal pages. Also I didn't have your image and linked to one of mine, but this is the code:

<!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" xml:lang="en" lang="en">
<head>
<title>New document</title>
<meta name="generator" content="TSW phpCoder 2010" />
<script type="text/javascript">
function open_window() {
window.open ('http://localhost/Test/test2.html','newwindow','height=418,width=590,toolbar=no,menubar=no,scrollbars=no,resizable=no,locat ion=no,directories=no,status=no')
}
</script>
</head>
<body>

<p><a onclick="open_window()"><img src="../TestPrograms/images/2.png" width="142" height="113" /></a></p>

</body>
</html>

To futher the experiment I then used yahoo as the html page and just a button to open the popup with this code:

<!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" xml:lang="en" lang="en">
<head>
<title>New document</title>
<meta name="generator" content="TSW phpCoder 2010" />
<script type="text/javascript">
function open_window() {
window.open ('http://www.yahoo.com/','newwindow','height=418,width=590,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,dir ectories=no,status=no')
}
</script>
</head>
<body>

<input type="button" value="Open Popup" onclick="open_window()" />

</body>
</html>

Worked in all browsers. Post the code that isn't working for you and I'll look at it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum