Question

How can i return response object in new window ? I mean, i need to response html page but in the new window like a target blank.

    $response = new Response($html);
    $response->setStatusCode(200); 
    return $response; 

Above code return the html page but in the same tab.

Was it helpful?

Solution

Symfony doesn't handle this. This is handled by client side functionality (target). The best thing to do is to make the trigger for your action open in a new window. So if your trigger is a link, you can do something like:

<a href="{{ path('yourRoute') }}" target="_blank">Open in new window</a> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top