Is it possible to resize a window in this situation?

7 replies
Heres my current code:

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><script language="JavaScript">alert('click here to continue'); window.location.href =
'myurl.com';</script></head>

I am sending users to this page and a little window pops up and asks them if they wish to continue. If they hit ok they get redirected.

The problem is I need to resize the window when they click ok. The window that this message pops up is stuck at a certain size. Is there a way to resize the window with an onclick script or something?

For example lets say the size of the window this message pops up in is 400x400. If they hit ok I want them to be redirected and the window resized to fit their screen. If i cant resize on the redirect, Is there a way to resize when they land on this 400x400 page while hitting them with the popup message?

thanks
#resize #situation #window
  • Profile picture of the author PRBandit
    You can make the 400x400 page do something like this. Except with the right code. (I dont know it right now exactly)

    parent.window.location = "your uRL to continuite to.com"
    this.window.close()

    Something like that might work?
    {{ DiscussionBoard.errors[6783927].message }}
  • Profile picture of the author TheSalesBooster
    nope that code above didn't work
    {{ DiscussionBoard.errors[6789885].message }}
  • Profile picture of the author davidsbain
    Try this
    w.resizeTo(900,900);
    {{ DiscussionBoard.errors[6796258].message }}
  • Profile picture of the author sham2
    i hope above code will work. Check this and share your experience.
    {{ DiscussionBoard.errors[6797832].message }}
  • Profile picture of the author locke815
    it doesn't really work.
    {{ DiscussionBoard.errors[6797956].message }}
  • Profile picture of the author KirkMcD
    Are you saying the Alert dialog is too small?
    No, you can't control its size.
    You need to do something custom with a form.
    {{ DiscussionBoard.errors[6801139].message }}
  • Profile picture of the author Liran Williams
    What about trying something like this...

    1. You're using a confirm dialogue instead of an alert dialogue because you want the yes or no buttons, otherwise with the alert dialogue you only have the ok button and it's not really giving the user much of a choice - because he/she can't do anything until they click on the OK button anyway, which makes the alert dialogue box pointless for your situation.

    2. With a confirm dialogue box you are now able to run a different set of instructions when the user clicks on the NO button, which wasn't possible with the alert dialogue box.

    3. window.moveTo and window.resizeTo will usually work on popup windows. and here what I am doing is positioning the window to the top left and resizing the window to it's maximum available size.

    4. I have called the askToProceed() function on form load like this... onload="askToProceed();". However, you could delete that and enter the code below within your HTML body, where ever you like:

    <script type="text/javascript">
    askToProceed();
    </script>

    Let me know if you have any questions.



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>My Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script language="JavaScript">

    function askToProceed()
    {
    response = confirm('Do you wish to proceed?');

    if(response)
    {
    //if user clicked yes
    window.moveTo(0,0);
    window.resizeTo(screen.availWidth,screen.availHeig ht);

    window.location.href = 'http://myurl.com';
    }
    else
    {
    //if user clicked no - Do Something Here
    }
    }
    </script>

    </head>

    <body onload="askToProceed();">



    </body>
    </html>
    {{ DiscussionBoard.errors[6818567].message }}

Trending Topics