CakePHP open to new tab on click


mark

I have a function in my app where user can upload files to web server. These uploaded files will then appear in another page where another type of user can click the link. After clicking the link, a new tab will open and the file will be displayed.

But I can't seem to do it. Using 'target' => '_blank' doesn't work, or maybe I put it in the wrong part of the code.

In my case, when you click the link, the file loads on the same tab.

Here is my code:

<?php
    echo $this->Html->link($staff_uploads['StaffUpload']['title'], array(
            'controller' => 'websites', 
            'action' => 'view', 
            'target' => '_blank', 
            $staff_uploads['StaffUpload']['iduploads']
            )
     );
 ?>

Thank you in advance!

Annans

The correct code is:

<?php
    echo $this->Html->link($staff_uploads['StaffUpload']['title'], array(
            'controller' => 'websites', 
            'action' => 'view',  
            $staff_uploads['StaffUpload']['iduploads']
            ), array('target' => '_blank')
     );
 ?>

And read the documentation as burzum suggested.

Related


CakePHP open to new tab on click

mark I have a function in my app where user can upload files to web server. These uploaded files will then appear in another page where another type of user can click the link. After clicking the link, a new tab will open and the file will be displayed. But I

Click the button to open a new tab

Nathan Wilson I want to create a link with a button that opens in a new tab. The code I'm currently using is currently opening a blank tab and I'm not sure why. <div class="text text-left"> <h2>WORK</h2> <h1>Title</h1> <p>Lorem ipsum dolor sit am

Click the button to open a new tab

Nathan Wilson I want to create a link with a button that opens in a new tab. The code I'm currently using is currently opening a blank tab and I'm not sure why. <div class="text text-left"> <h2>WORK</h2> <h1>Title</h1> <p>Lorem ipsum dolor sit am

Open a new tab after button click in AngularJS

Neptune: <button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $http.post('www.google.com'); } What I want is to post a requirement and then open the response html in a new tab when the "openTab" button

Selenium - click on the link to open a new tab

tree 55 I've seen a lot of threads on how to open a link in a new tab, but what if you have a link that creates a new tab and you need to verify the title? All I need to do is click the link -> confirm the new tab has the correct title -> close the tab and con

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Click on DIV to open embedded background in new tab

Paul VI I am dynamically inserting a background image in a DIV. <div class="mc-image " title="The Bridges" style="background-image: url(image.jpg);" data-href="link.html"></div> <div class="mc-image " title="The Bridges" style="background-image: url(image2.jpg

Click on filename to open in new tab with Sublime

Budge Usually in my personal readme.txt file/log file I have some references to other .txt files. It can be a relative path ( ..\notes\blah.txt) or an absolute path (as shown in the screenshot below). Is it possible for a .txt file to have this behavior in Sub

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Open a new tab after button click in AngularJS

Neptune: <button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $http.post('www.google.com'); } What I want is to post a requirement and then open the response html in a new tab when the "openTab" button

Right click on svg to open new tab with element

Yukulele With firefox, when I middle-click (or ctrl+click) on an useelement , it will open the url xlink:hrefin a new tab (like href) Bug or feature? <svg viewBox="0 0 400 80"> <circle id="circle" cx="40" cy="40" r="30" fill="#29e"></circle> <use xlink

Selenium - click on the link to open a new tab

tree 55 I've seen a lot of threads on how to open a link in a new tab, but what if you have a link that creates a new tab and you need to verify the title? All I need to do is click the link -> confirm the new tab has the correct title -> close the tab and con

Selenium - click on the link to open a new tab

tree 55 I've seen a lot of threads on how to open a link in a new tab, but what if you have a link that creates a new tab and you need to verify the title? All I need to do is click the link -> confirm the new tab has the correct title -> close the tab and con

Open new tab on button click using JQUERY

Rajan My scene is like this: I have edit user module. Each user is assigned a base INI file . When we edit a user, we have a drop down menu from which to select his base INI file. After selection, we can save the user. And the ID of the selected file is also s

Right click on svg to open new tab with element

Yukulele With firefox, when I middle-click (or ctrl+click) on an useelement , it opens the url xlink:hrefin a new tab (like href) Bug or feature? <svg viewBox="0 0 400 80"> <circle id="circle" cx="40" cy="40" r="30" fill="#29e"></circle> <use xlink:hre

Click on the image to open a new tab in the HTML page

Gillan click on image to open new tab in html page how to add clickable image to open new tab in html page? Jeffrey Try this https://www.w3schools.com/jsref/met_win_open.asp <!DOCTYPE html> <html> <body> <p>Click the button to open multiple windows.</p> <a h

Click on DIV to open embedded background in new tab

Paul VI I am dynamically inserting a background image in a DIV. <div class="mc-image " title="The Bridges" style="background-image: url(image.jpg);" data-href="link.html"></div> <div class="mc-image " title="The Bridges" style="background-image: url(image2.jpg

Click on filename to open in new tab with Sublime

Budge Usually in my personal readme.txt file/log file I have some references to other .txt files. It can be a relative path ( ..\notes\blah.txt) or an absolute path (as shown in the screenshot below). Is it possible for a .txt file to have this behavior in Sub

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't

Click on filename to open in new tab with Sublime

Budge Usually in my personal readme.txt file/log file I have some references to other .txt files. It can be a relative path ( ..\notes\blah.txt) or an absolute path (as shown in the screenshot below). Is it possible for a .txt file to have this behavior in Sub

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Click on filename to open in new tab with Sublime

Budge Usually in my personal readme.txt file/log file I have some references to other .txt files. It can be a relative path ( ..\notes\blah.txt) or an absolute path (as shown in the screenshot below). Is it possible for a .txt file to have this behavior in Sub

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Click Primefaces in a new tab on the button to open the page

username i have this <h:outputLink value="http://.....index.html" target="_blank">open</h:outputLink> But it shows up as a link. How to create a similar button? I need the "Open" button. When I press this button I need to open the link in a new tab in the bro

Click on DIV to open inline background in new tab

Paul VI I am dynamically inserting a background image in a DIV. <div class="mc-image " title="The Bridges" style="background-image: url(image.jpg);" data-href="link.html"></div> <div class="mc-image " title="The Bridges" style="background-image: url(image2.jpg

Right click to enable "open in new tab/window"

Michael Chodakis My link is a javascript function that shows the loader and then navigates to the target link: <script> function go(url) { document.body.innerHTML = "some loader html"; window.location = url; } </script> <a href="javascript:go('test.php');"

Open new tab on button click using JQUERY

Rajan My scheme is this: I have edit user module. Each user is assigned a base INI file . When we edit a user, we have a drop down menu from which to select his base INI file. After selection, we can save the user. And the ID of the selected file is also saved

Protractor button click and open page in new tab

Sumitomo I am new to protractor. I'm trying to automate a scenario where I click a button and it opens a page in a new tab and then we need to populate the form in the new page and submit it. Problem : When I click the button to open a new page. My tests don't