Javascript: Open a custom new browser window within your html code

Whatz up Andre!


1) The JavaScript function to open a new browser (remember this is also called a popup...many tools will block it) is:
window.open("URL","Name","Optional_Windows_Attributes")

With:
URL(required): URL to the target.
Can be a relative path like myGreatPageName.htm or absolute http://www.sitebuddy.com
Name(optional): is the name of the new windows, it can be empty: ""
Optional_Windows_Attributes(optional): a comma separated list of Window properties/attributes.

The Windows attributes can be any of:
width: in pixel example, width=500
height:  in pixel example, height=400
left: in pixel offset from the left side of the screen, example left=100
top: in pixel offset from the top of the screen, example top=100
toolbar: 0 or 1 to indicate if the new window should have the toolbar (back, forward ...)
location:  0 or 1 to indicate if the new window should have the location bar (where you enter URLs ...)
directories: 0 or 1 to indicate if the new window the should have the "bookmars, what's new..." bar
status
:  0 or 1 to indicate if the new window should have the status bar (the bar at the bottom of the browser...)
scrollbars:  0 or 1 to indicate if the new window should have the scrollbars
resizable:  0 or 1 to indicate if the new window should be resizable
menubar:  0 or 1 to indicate if the new window should have menus
titlebar:  0 or 1 to indicate if the new window should a title bar
fullscreen:   0 or 1 to indicate if the new window should use the full screen

2) Now define a JavaScript function:
Note you could skip this step and call directly the "window.open" function, within the HTML (see example later).

<script>
function loadwindow(){
window.open("http://www.sitebuddy.com/view/MySQL","","width=500,height=400,status=1")
}
</script>

3) Now how to call your JavaScript function:

<form><input type="button" onClick="loadwindow()" value="Load Window"></form>

or:

<a href="" onclick="loadwindow()">Sitebuddy.com rocks>Sitebuddy.com rocks</a>

Sitebuddy.com rocks

or:

<a href="javascript:void(0)" onclick="javascript:window.open('http://www.sitebuddy.com/view/MySQL','MyWindow','width=500,height=400,status=0,toolbar=0, location=0,resizable=0,menubar=0,titlebar=0'); return true;">Sitebuddy.com check out those MySQL article, they rock</a>

Sitebuddy.com check out those MySQL article, they rock



Hey no problem buddy! If

Hey no problem buddy!
If you can't do javascript this will definitly not work.
What you might be able to do is use the anchor tag <a> to open a page on a web site you control and have that page open the way you want it. Like so:

<a target="_blank" href="http://www.sitebuddy.com/demoonload.htm"> MySiteMyPage</a>
Test here: MySiteMyPage

and then on your site at http://www.sitebuddy.com/demoonload.htm have that page resize. If you actually need to change the statusbar/locationbar ..etc.. on the new windows properties you would have to open a new window, with your properties, and close the first window (window.close();), it's pretty ugly.
Basically you can't modify stuff like statuBar.visibleOrNot once the window is open (just certain operations are permitted like rezise move etc...). I think it was to abused in the past so browsers (like IE) has restricted those operations.
Good luck!

Hey man, i think i've got

Hey man,
i think i've got this part down - my only issue is that since i am posting the link in a message board, i can't "call" the javascript because it won't let me post code, only an address. unless i am misunderstanding something - all these "calls" are to create a button or link to the pre-formatted page, but in a message board i can't put this type of code so i guess i was wondering if it possible to put instruction on a particular page in frontpage to tell it how to open when someone clicks on a link to see it.
Let me know if you know a solution or don't really understand the problem.
thanks a ton man
-andre