How can i open the redirect link in a new tab

Viewed 30

I want the the link $down to open in a new tab, I tried using the redirect to but it didn't work, please help me out

if($item->file_host === 'local')
      {
        $down = ($item->direct_download_link);
        
        return redirect()->to($down);
      }
      
      return back();
    }
1 Answers

You need to use javascript on the page you redirect to that opens an URL in a new tab.

For example, in pure PHP:

echo "<script>window.open('".$url."', '_blank')</script>";
Related