www.webdeveloper.com
Results 1 to 6 of 6

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

  1. #1
    Join Date
    May 2004
    Posts
    442

    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
    Posts
    133
    its javascript
    Code:
    <script language="javascript" type="text/javascript"> 
    <!--
    function myPopup() {
    window.open( "newwindow.html", "myWindow","status = 1, height = 300, width = 300, resizable = 0" )
    }
    //-->
    
    </script>
    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
    Posts
    442
    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 07:29 AM.

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


    edit:

    Code:
    <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 11:14 AM.

  5. #5
    Join Date
    Nov 2007
    Posts
    316
    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.

  6. #6
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    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