Solved

Maximizing the size of  IE window launched with _blank html

Posted on 2006-11-21
14
352 Views
Last Modified: 2009-07-29
I am launching a new IE window using the _blank html. I want the size of the window to be maximum for the
screen - what I am getting is a window of apparently some arbitary lesser size.

Many thanks for any ideas
0
Comment
Question by:jameskane
[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
  • 7
  • 6
14 Comments
 
LVL 97

Expert Comment

by:war1
ID: 17990704
Greetings, jameskane !

Click on a link to open a second browser window. Drag the corners of the new window to full screen. Do not hit the maximum icon. Close the first browser first, second browser second.
Or
Modify the registry key HKCU\Software\Microsoft\Internet Explorer\Main\FullScreen REG_SZ to "yes".

Opening Internet Explorer Full Size
http://www.mvps.org/winhelp2002/ietips.htm


Best wishes!
0
 

Author Comment

by:jameskane
ID: 17990841
Hi, very many thanks for the quick reply. I have tried with success the first strategy you noted. Works great.

However, my question is how do I communicate that procedure to whomever visits the website and clicks the link on the first page with the _blank command ??

I have found that a body tag
onload="window.resizeTo(500,500)"
in the page launched in the second window will give me a window sized 500 X 500.  Is there any way to adopt this
tag to have the size of the second window default to maximum ??

many thanks again

jim
0
 
LVL 2

Expert Comment

by:maxkh
ID: 17990976
I assume you talk about <a target="_blank">, right?
You can't >maximize< a window, however you can resize it fill the screen.
But in order to do so, you need a reference to the new window object,
and by using target="_blank" you don't have a reference.

You need to use window.open() to get a reference to the new window
and then use window.moveTo(0,0) and
window.resizeTo(screen.availWidth,screen.availHeight)
All this can be bundled to a function that runs when clicking the <a> element.

<script>
function openFullWindow(url){
  var newWin=window.open(url);
  newWin.moveTo(0,0);
  newWin.resizeTo(screen.availWidth,screen.availHeight);
  return false;
}
</script>

NOTICE: the browser WON'T let you resize the window if the url is on the DIFFERENT DOMAIN. It is a security feature. You can manipulate windows that open only pages on the SAME domain as the parent page.
0
Increase your protection from Zero Day threats!

Running two Antivirus' is never a good idea.
Taking advantage of Multiple Security layers on the other hand can often save your hide.
See which top notch security software brands have been proven to happily coexist together.
Reduce your chances of becoming a statistic.

 

Author Comment

by:jameskane
ID: 17991141
here's where I  show my limitations !!

I created the following page, with the function included between the head tags. I did not make any
reference to this function within the A tag, which is probably why it did not work. Could you tell me how
to link to the function from within the A tag. Many thanks for your patience !!

jim

<!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">
<head>

<script>
function openFullWindow(url){
  var newWin=window.open(url);
  newWin.moveTo(0,0);
  newWin.resizeTo(screen.availWidth,screen.availHeight);
  return false;
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<a href="index.cfml" title="dfqds" target="_blank" >azera</a></body>
</html>
0
 
LVL 2

Expert Comment

by:maxkh
ID: 17993746
try:
<a href="javascript:openFullWindow('index.cfml')" title="dfqds">azera</a>  <-- you don't need target=_blank

or:
<a href="index.cfml" title="dfqds" target="_blank" onclick="javascript:openFullWindow('index.cfml'); return false;" >azera</a> <---the "onclick" overrides the default action of the anchor tag

0
 

Author Comment

by:jameskane
ID: 17994200
Thanks maxkh, that works fine. I have also a form button which triggers a new page. Would you be able to show
me how to integrate the funcition into that code ? The idea is to get the page
../image_thumb_page_artist_unique_music.cfm
to launch is a new window, full size. The piece of code is  below.

Sorry for the extra question.

Jim

</div>

<div id="Layer2" style="position:absolute; left:405px; top:363px; width:154px; height:30px; z-index:2">
<form action="../image_thumb_page_artist_unique_music.cfm" method="post" name="web_name" target="_blank" id="web_name">
          <p>
<input type="submit" name="Submit" value="Parcourir / Browse">
<input name="web_name" type="hidden" id="web_name3" value="<cfoutput>#Session.path#</cfoutput>">
      </p>
  </form>

</div>

0
 
LVL 2

Accepted Solution

by:
maxkh earned 500 total points
ID: 17995291
I see that you are trying to submit the form to a page, but you want the submitted page to appear in a new window.
But what will happen to the window with the form? Will it stay unchanged?
If so, the it gets a bit complicated...

You can try this:
function submitToNewWindow(formElement){ //you pass the form tag to the function

  //open a blank new window and NAME IT as myNewWindow:
  var newWin=window.open('',"myNewWindow");
   
  newWin.moveTo(0,0); //move it
  newWin.resizeTo(screen.availWidth,screen.availHeight); //resize it

// make the new window as a submit target by specifying the name of it
// (not the window object, but the name string)

  formElement.target="myNewWindow";
  formElement.submit(); //submit it manually
  return false;
}

The form tag will be like this:
<form action="../image_thumb_page_artist_unique_music.cfm" method="post" name="web_name" id="web_name" onsubmit="return submitToNewWindow(this);">

We are using "onsubmit" event to cancel the default submit behaviour.

Good luck!
0
 

Author Comment

by:jameskane
ID: 17997004
Hi, First off, many thanks for taking the time on this !!

Yes the page with the form will remain unchanged I'm afreaid. Thats because I have a flash sound track on it that needs  to keep playing ( hence the need for the new window).

I've just tried the code you sent, but it does not seem to work. Justs to check, I have created the function you suggested and placed it just under the header tag. This is it below.

=====================================

<head>


<script>
function submitToNewWindow(formElement){ //you pass the form tag to the function

  //open a blank new window and NAME IT as myNewWindow:
  var newWin=window.open('',"myNewWindow");
   
  newWin.moveTo(0,0); //move it
  newWin.resizeTo(screen.availWidth,screen.availHeight); //resize it

// make the new window as a submit target by specifying the name of it
// (not the window object, but the name string)

  formElement.target="myNewWindow";
  formElement.submit(); //submit it manually
  return false;
}
</script>

======================

Then I changed the form action as you suggested to

<form action="../image_thumb_page_artist_unique_music.cfm" method="post" name="web_name" id="web_name" onsubmit="return submitToNewWindow(this);">


The image_thumb_page_artist_unique runs ok, but not in a full sized window. The original page with the form remains intact as needed

jim


0
 

Author Comment

by:jameskane
ID: 17997104
While its true the orignial page with the form needs to remain intact, this should not present a problem, because when
i want to get back to it from the image_thumb_page_artist_unique_music page, I have a return mechanism which simply closes this wiindow and leaves the originating window visible.

thats the way it works at the moment.  For your interest, the link is

http://art-en-ligne.net/CHEIM
0
 
LVL 2

Expert Comment

by:maxkh
ID: 17997835
hmm.... that's strange...
I have it working fine.

Just checking: which browser are you using?
I have it working on ie6 and firefox 2.
Also, do you have any software that blocks certain script behavior?
Firefox have a built-in option to disable window resize by script, and i think it's turned on by default.
0
 
LVL 2

Expert Comment

by:maxkh
ID: 17997847
Oh, and do you get any script error messages?
0
 

Author Comment

by:jameskane
ID: 17997879
I'm using IE 6 as well. No crript blocking behaviour comes to mind.

0
 

Author Comment

by:jameskane
ID: 18001367
Haxkh,

IT WORKS !!!!!!!!!!!!!

problem was at my end - with the target page. Your code is exactly correct!! Fantastic !!

many thanks
0
 
LVL 2

Expert Comment

by:maxkh
ID: 18001417
Happy to hear :)
0

Featured Post

RoboForm Secure Password Management System

RoboForm Everywhere - Superb Browser Support
Windows / Apple / IOS / Android / Linux / Chrome OS
Use different complex passwords everywhere
Best Secure Password Management by far
Synchronize all of your devices instantly
Safe, Secure & Highly Recommended!

Question has a verified solution.

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

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

734 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