Solved

Maximize pop up window from another site with JavaScript

Posted on 2004-08-05
5
1,863 Views
Last Modified: 2012-05-05
I have a link in my site and I want that, when it is clicked, opens a new pop up window maximized (with for example http://www.anothersite.com/, not with a page that is hosted in my web). Because it is hosted in another site, I cannot use something like this (I cannot edit that page because it's in other site):

<script language="JavaScript1.2">
<!--
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
//-->
</script>

I would like that the page "maximizes" to highest resolution available , no matter if the user has 800x600 or 1024x768 or another....
I don't know if it's possible to maximize, or only simulates this, resizing the window to these measures.
Thank you very much for your help. ;)
0
Comment
Question by:DeLaVegaz
5 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 38 total points
ID: 11730073
Hi

Use window.open:

var width=500;
var height=300;
if (screen) {
   width = screen.width;
   height = screen.height;
}
window.open(URL,NAME,'width='+width+',height='+height);


If you want it totally full screen, though, in IE, you can do this:

window.open(URL,NAME,'fullscreen=yes');

Regards,
Zyloch
0
 
LVL 33

Assisted Solution

by:knightEknight
knightEknight earned 37 total points
ID: 11730086
create a local page (on your website) that opens the window and sizes it, then redirect it to the other site:

<HTML>
<HEAD>
<script language="JavaScript1.2">
<!--
top.window.moveTo(0,0);
if (document.all) {
  top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
  if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
     top.window.outerHeight = screen.availHeight;
     top.window.outerWidth = screen.availWidth;
  }
}

location = "http://www.otherdomain.com/othersite.html";

//-->
</script>
</HEAD>
</HTML>
0
 
LVL 18

Expert Comment

by:arantius
ID: 11732163
Don't do it.  Users do not enjoy it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now