Zend framework redirector-> gotoUrl () with target = _blank

When submitting the form, I want to send my visitor to an external url to do something, but I hope that he continues to browse my site. In html, I would give it this opportunity with href = "http://www.example.com" target = "_ blank".

But I can not find how to do this when I do this:

$this->_helper->redirector->gotoUrl('http://www.example.com'); 

inside my action with the controller. Nothing found on Google, documentation or SO. Is it just not possible?

+4
source share
3 answers

Impossible. You cannot tell the browser what to do in this scenario.

+5
source

You can achieve this effect with Javascript:

  • submit the form
  • when successfully opening a new tab with an external page using JS
  • redirect to a new place in your application on the old tab
+2
source

Now it’s possible:

$ link = new PTA_Link (); $ Link-> setTarget ('_ empty');

0
source

Source: https://habr.com/ru/post/1381532/


All Articles