Search code examples
phphtmlhyperlinkhref

Open New Tab / New Window


i am unable to open file in new window.any one help me regarding this issue

 echo '<a href="'. $fileStorage . $row['file'] .'">'. htmlentities('Click Here', ENT_COMPAT, 'UTF-8') .'</a><br />';

where to write target='_blank' in the above code.


Solution

  • You need to add target attribute:

    echo '<a href="'. $fileStorage . $row['file'] .'" target="_blank">'. htmlentities('Click Here', ENT_COMPAT, 'UTF-8') .'</a><br />';
    

    _blank => Opens the linked document in a new window or tab