'run file pdf without popup download laravel

I launched the following code and it works fine. The file (http://127.0.0.1:8000/dl/file.pdf) opens as a download pop-up.

pop-up

/routes/web.php

<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PDFController;
Route::get('/dl/file.pdf', [PDFController::class, 'generatePDF']);

/app/Http/Controllers/Frontend/PDFController.php

<?php
namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use PDF;
class PDFController extends Controller
{
    public function generatePDF()
    {
        $data = [
            'title' => 'Welcome to Laravel',
            'date' => date('m/d/Y')
        ];
        $pdf = PDF::loadView('front.pdf', $data);
        return $pdf->download('laravel.pdf');
    }
}

/front/pdf.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>PDF - Laravel</title>
</head>
<body>
    <h1>{{ $title }}</h1>
    <p>{{ $date }}</p>
    <p>It is a test.</p>
</body>
</html>

I know this code $pdf->download('laravel.pdf') is downloadable.

I read this link Laravel - display a PDF file in storage without forcing download?, but it does not work.

I do not want to show pop-up download.



Solution 1:[1]

Chrome enter image description here

Edge enter image description here

Firefox enter image description here

Pale Moon secured with no JavaScript allowed enter image description here

Correcting web spelling inline before print

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1