Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

Maximizing the size of IE window launched with _blank html

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
jameskane
Asked:
jameskane
  • 7
  • 6
1 Solution
 
war1Commented:
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
 
jameskaneAuthor Commented:
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
 
maxkhCommented:
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
Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

 
jameskaneAuthor Commented:
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
 
maxkhCommented:
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
 
jameskaneAuthor Commented:
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
 
maxkhCommented:
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
 
jameskaneAuthor Commented:
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
 
jameskaneAuthor Commented:
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
 
maxkhCommented:
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
 
maxkhCommented:
Oh, and do you get any script error messages?
0
 
jameskaneAuthor Commented:
I'm using IE 6 as well. No crript blocking behaviour comes to mind.

0
 
jameskaneAuthor Commented:
Haxkh,

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

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

many thanks
0
 
maxkhCommented:
Happy to hear :)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now