Results 1 to 6 of 6

Thread: How do I open a new window in php?

  1. #1
    Join Date
    May 2004

    How do I open a new window in php?

    I tend to copy ideas from other web sites, and I noticed that at play.com
    ( which is actually in ASP ), they open a popup window from a the ASP when an item on a form is clicked on. The form is nothing special, it handles submitting info for buying products, but interestingly has a zoom for a product image. This is just an additional input for the form.

    <input type="hidden" name="returnURL" value="http://www.play.com/DVD/DVD/4-/1064367/Miami-Vice/Product.html" />

    My question is, how is the popup actually opened? I was not aware this could be done from the server side? I am guesing there must be some javascript or something, but what? Go to the site, www.play.com, browse the dvd's and click on an "Enlarge Image" and you will see what happens.

  2. #2
    Join Date
    Apr 2007
    its javascript
    <script language="javascript" type="text/javascript"> 
    function myPopup() {
    window.open( "newwindow.html", "myWindow","status = 1, height = 300, width = 300, resizable = 0" )
    create a page newwindow.html then within your body tags
    HTML Code:
    <a href='#' onClick="myPopup()">New Window</a>

  3. #3
    Join Date
    May 2004
    No it's not!
    The site I am talking about is using a submit inside a form to open the window, which means there must be something in PHP ( well, actually ASP ) acting as the driving force. It does not use target either.
    Last edited by SuzanneB; 12-30-2007 at 06:29 AM.

  4. #4
    Join Date
    Dec 2007
    Swindon, England.
    no, it is javascript. PHP cannot open new windows. this shouldnt be in the php forum?


    <a href="#" onclick="javascript:window.open('/DVD/DVD/4-/3595859/-/EnlargedImage.html','3595859','width=374,height=542')"><img src="http://images.play.com/SiteCSS/Play/v9.114/img/button/enlargeimage.gif" alt="Enlarge Image" style="border-width: 0px; height: 17px; width: 99px;"></a>
    see that? window.open.
    Last edited by smickus; 12-30-2007 at 10:14 AM.

  5. #5
    Join Date
    Nov 2007
    Quote Originally Posted by SuzanneB
    which means there must be something in PHP ( well, actually ASP )
    PHP and ASP are Server Side languages. They cannot read/manipulate the client. HTML, Javascript, etc. are Client Side languages so they can do stuff like open new windows.
    David Walker
    Software Engineer
    - C++ guru
    - C# guru
    - PHP guru
    - Testing guru
    Theatatrical Tech
    - Sound Engineer
    - Lighting Designer
    - Stage manager

  6. #6
    Join Date
    Mar 2005
    Sydney, Australia
    The only two ways to request to open a new window are.

    1. In HTML using the deprecated target= attribute.
    2. In JavaScript using window.open()

    In either case it then depends on how the specific visitor has their browser configured as to whether a new window or new tab will be opened or whether the new page will just overwrite the current page.

    No server side language has any access to do anything client side and even client side languages only have as much access outside of your actual web page as the individual visitors permit (and browsers are gradually tightening their default security to further limit access beyond the web page itself).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles