#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0

    How to open new window


    Hi everyone,

    i am not so familiar still in php and there is one question ..
    There is current code :

    if ( $link= new link( $index ) )
    {
    var_dump( $link);
    if ( $link->index )
    {
    $link->downloads++;
    $link->update();
    // Redirect to download
    header( "Location: $link->url" );
    }
    }

    Basically it will fetch the url but a new tab will be open for this download. There are 2 things / ways i would like to inq. on how i can do this (either one)
    1) since this will open a new tab and then continue with the download, i would like to hide this new tab. maybe can this be done... (the download will be triggered once the page is loaded) the new tab will be opened as usual but there will be a countdown of few seconds and the new tab will be closed automatically ? with the time frame of the few seconds, the download will be triggered and i do not need the tab to be opened anymore.

    2) can this open in new tab converted to open in new window ? So after countdown of few seconds, the new window will be closed automatically as well ? If i still remember (during college time) this cant be done at the other side right ? i will need jscript to do this ?

    * my purpose is to hide this new tab / new window but i still need it to be loaded coz the download will only be trigerred once the page is loaded. When the download starts / prompted, i will no longer need the tab / new windows / the url any longer.

    How possible this can be done ?
    thanks
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
    PHP does not open new windows or tabs. Whatever link or button you clicked did that. That's where it has to be fixed.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0
    Originally Posted by requinix
    PHP does not open new windows or tabs. Whatever link or button you clicked did that. That's where it has to be fixed.
    I see...
    so would that be this part then under the .js

    songItem.find( ".songValueTag" ).text( "Download link is ready, Click to proceed with the download" ).
    attr( "href", "download.php?id=" + id ).
    attr( "target", "_blank" );
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    Originally Posted by firezz
    attr( "target", "_blank" );
    That it is. The "target" attribute is bad, anyway. Depending on your (X)HTML version it's probably not even valid.
  8. #5
  9. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
    Originally Posted by Jacques1
    The "target" attribute is bad, anyway. Depending on your (X)HTML version it's probably not even valid.
    Fun fact: HTML 5 allows it.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0
    Basically after reading.. i am looking at these few lines... perhaps this can be changed accordingly ?

    var result = $.parseJSON( response );
    if ( result.success )
    {
    songItem.addClass( "songItemValid" );
    songItem.find( ".songButtons" ).remove();
    songItem.find( ".songNumber" ).remove();
    songItem.find( ".songDetails" ).attr( "style", "text-align: center" );
    songItem.find( ".songValueTag" ).text( "Download link is ready, Click to proceed with the download" ).
    attr( "href", "download.php?id=" + id ).
    attr( "target", "_blank" );
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    caisses enregistreuses


    [[ temp banned this user for spam, but this particular post is actually relevant --requinix ]]

    According to [spam website]
    The general syntax of the window.open() method is as follows:

    winRef = window.open( sURL, sName [ , sFeatures [, bReplace ] ] )
    The return value, stored in the variable winRef, is the reference to your new window. You can use this reference later, for example, to close this window (winRef.close()), give focus to the window (winRef.focus()) or perform other window manipulations.
    The parameters sURL, sName, sFeatures, bReplace have the following meaning:
    sURL String specifying the location of the Web page to be displayed in the new window. If you do not want to specify the location, pass an empty string in sURL (this may be the case when you write some script-generated content to your new window).
    sName String specifying the name of the new window. This name can be used in the same constructions as the frame name provided in the frame tag within a frameset <FRAME NAME=sName ...>. For example, you can use hyperlinks of the form <a target=sName href="page.htm">, and the hyperlink destination page will be displayed in your new window.
    If a window with this name already exists, then window.open() will display the new content in that existing window, rather than creating a new one.

    sFeatures An optional string parameter specifying the features of the new window. The sFeatures string may contain one or more feature=value pairs separated by commas.
    bReplace An optional boolean parameter. If true, the new location will replace the current page in the browser's navigation history. Note that some browsers will simply ignore this parameter.
    The following features (set in the sFeatures parameter) are available in most browsers:
    toolbar=0|1 Specifies whether to display the toolbar in the new window.
    location=0|1 Specifies whether to display the address line in the new window.
    directories=0|1 Specifies whether to display the Netscape directory buttons.
    status=0|1 Specifies whether to display the browser status bar.
    menubar=0|1 Specifies whether to display the browser menu bar.
    scrollbars=0|1 Specifies whether the new window should have scrollbars.
    resizable=0|1 Specifies whether the new window is resizable.
    width=pixels Specifies the width of the new window.
    height=pixels Specifies the height of the new window.
    left=pixels Specifies the X coordinate of the top left corner of the new window.
    top=pixels Specifies the Y coordinate of the top left corner of the new window.
    Last edited by requinix; December 7th, 2012 at 01:06 AM.

IMN logo majestic logo threadwatch logo seochat tools logo