Open in same browser tab from Trello - html

I am creating a link in a Trello card to an external link. What I want to achieve is that this link opens in the same browser tab ( _self ) or opens in a new browser tab and return to this tab if the link is activated again. As it is now it generates a new browser tab every time clicking the link. Is there any suggestion to achieve this ?

You can set specific window's name, in order to open reuse the tab. You can do the following way.
Foo
Bar
Or this way also..
<div id="tabopen">
link
</div>
<script>
document.getElementById("tabopen").onclick = function(evt){
if (evt.target.tagName === "A")
window.open(evt.target.href, evt.target.href);
return false;
}
</script>

This is a very old question, but I thought I should add that in 2022:
Adding a link as an attachment to the card opens the url in a new tab when you click on it.
Adding a link as text in the description of the card opens the link in the same tab when you click on it.

Related

How can open whatsapp api link in the same new tab every time

I have a whatsapp contact link on my page. I want to open it in a new tab. But if it is already opened, i want to go to this tab (the already opened) instead of open a new tab.
I tried:
<a target="_blank" href="https://api.whatsapp.com/send?phone=">Whatsapp</a>
But every time it opens in a new tab, any ideas?
For a better solution, try opening the whatsapp tab in a new popup instead of the browser tab.
As a page can not keep track of other pages/tabs open on the client side.
You can use a popup to open up the whatsapp page, and can control it through javascript/jQuery
The latter page can also control the main page through javascript commands like parent.
Try rewriting the link as ,
Whatsapp

Open URL in new browser tab when click on HTML button

I am designing a web site with CodeIgniter and I want to open some URL when user click on its buttons (URLs have to open in new tab).
I use this code and it works when you want to open URL in same tab, but I want the URL to open in a new tab. I don't want to use JavaScript function too.
<button type="button" onclick="location.href='http://google.com'">Google</button>
If you could change your button to be an anchor...
Google
Then you could add styling to your anchor... if this is even required.
Try something like this
<button type = "button" onclick = "location.href = window.open('link')"></button>

Open chrome extension in a new tab

I have implemented a chrome extension. Was wondering if the popup.html can be opened in a new tab? Every single click on the page, and the popup disappears :( .. Was wondering if I can stick it to the page or is there a way to open the extension in a new page?
Yes, a popup page is just a normal extension page, you can do the following to open a new popup tab from the background page. I use that every time when the user first installs the extension, I open the about page, you can do the same for the popup page.
chrome.tabs.create({url: 'popup.html'})
For one of my extensions, My Hangouts, I have a small "open as tab" button within the popup, I bind the click event for that link to execute this:
chrome.tabs.create({url: chrome.extension.getURL('popup.html#window')});
The reason why I passed the hash is because I wanted to add more content when the user opens it in a popup because there is more real estate to play with.
Within the popup, I use normal JavaScript to differentiate whether I opened the tab in the new tab page or in a normal page like the following:
if (window.location.hash == '#window') {
this.displayAsTab = true;
}
You can do tricks like this to make your extensions user experience better.
here is the same issue: Chrome Extension: onclick extension icon, open popup.html in new tab
use:
chrome.tabs.create({'url': chrome.extension.getURL('popup.html')}, function(tab) {
// Tab opened.
});
property "pinned" to stick the tab.

Open a link to new tab inside a ifame of iframe

I have a iframe-1 and it contains another iframe-1-1.[1]
Inside iframe-1-1 which contains a link.
When a user click the link:
It should open a new tab (For instance, Firebug/or Chrome).[2]
But it does not work. How can I do that?
[1] Why I have this question: because I code a webpage, it is embedded in Facebook, and I call FB.dialog it will show me a dialog is a iframe too.
[2] It works properly if I use wheel button to click.
You can't instruct a browser to open a new tab. The best you can do is to use target="_blank" and hope that the user is using a browser that will open a tab and not a new window.

How do I focus an existing tab in a window? (web page, not extension)

I'm trying to focus an existing tab when the content reloads. The usual window methods don't seem to work.
Here's whats happening: On page_1 I have a link like...
Go to my other page
If the tab doesn't exist, when the link is clicked it opens a new tab and takes focus. (Perfect)
If you then go back to page_1 and click the link again, it reloads the content in the existing tab (perfect) but doesn't focus (crap). I've tried the usual window.focus, $(window).focus methods on load with page_2 without luck.
Any recommendations?
It is impossible.
The following appears to work in IE8 and FF13:
<script type="text/javascript">
// Stupid script to force focus to an existing tab when the link is clicked.
// And yes, we do need to open it twice.
function openHelp(a) {
var tab = window.open(a.href, a.target);
tab.close();
tab = window.open(a.href, a.target);
return false;
}
</script>
Help
There is a workaround to this. Use javascript to open a window in a new tab, store a reference to that tab, and when you want to focus it; close it first and then re-open it.
if (window.existingWindow != null)
try { window.existingWindow.close(); } catch (e) { };
window.existingWindow = window.open("/your/url", "yourTabName");
We use a similar approach to opening the preview pane of the current page you're working on in our service called Handcraft where the above works as expected (we wanted the new window to always focus).
Without using a framework you can put a script block at the bottom of your page that will run once the page loads. Because it is after your HTML you can be assured that the HTML is refers to is actually available.
The script can set the focus to the element you want.