Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open window in javascript

Status
Not open for further replies.

sephiroth100

IS-IT--Management
Mar 25, 2010
1
0
0
GB
Hi,

Sorry if this is quite a basic thing to some of you guys, but I've been searching the web for a couple of days now and I can't find an answer that covers my wants completely.

I am coding a website in c#/.net. I have a couple of functions which need a new window opening: 1) a send to a friend form; 2) a contact us form. I have chosen to open a new window in both cases because the user is positioned on a list item when they click the button.

In order to keep the number of windows to a minimum, they both call the same window name, let's say "popup".

Both the windows are different sizes.

I have constructed an open window function which is called when each link is clicked, shown below:

var nw=window.open(this.href,this.target,'width=680,height=541,resizable=1');nw.focus();nw.resizeTo(670,616);return false;

The second one is the same but with different sizes.

The above code whould open a new window, however if its already open and is the other size window, it should resize. When going from the smaller to larger window it does resize, however the larger window never decreases in size.

The issue is currently being tested in Firefox.

Ideally I would like to take it one step further (like Facebook bookmarking) where a window is opened then dynamically resized (length only) to fit the content.

If I can't achieve this then the first solution to maintain the correct widow size across both forms would be ok.

Thanks in advance.
 
Hi there,

Have you tried using window.innerHeight and window.innerWidth?

Code:
window.innerWidth = 1200;
window.innerHeight = 400;


~Ron

typedef map<GiantX,gold, less<std::shortestpathtogold> > AwesomeMap;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top