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.

Était-ce utile?

La 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> 
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top