Opening new tab in the background - javascript

I am trying to open a new tab in the background as on vouchercodes where you open the link and return to the previous tab. I have read this is not possible in Javascript. I am using JQuery mobile.
So far I have

As far as i know, the new tab behaviour is a browser setting which is set by the user. You can't open an link in background with Javascript/jQuery.

Use
<a target="_blank" href="javascript:void(0)" onclick="window.open('http://google.com'); document.getElementById('show').style.display='';return false;"></a>
But you can't go back from tab a to b impossible.

Related

How to open a link automatically in new tab which is containing in external website like quora.com?

How to get a link from a external website like a Quora.com and how to click it automatically which should open in a new browser tab, how to do it using JQuery or JavaScript or Android or iOS.
what are the procedures should i follow.
Get the link from external website like Quora.com
click that link automatically using Jquery or Android or JavaScript
or iOS.
The clicked link should open in new tab or window
I am answering based on what I understood so far.
In your HTML , you can have one Anchor tag .
<a id="aExternalLink" href="http://colorssoftware.com" target="_blank" ></a>
$(document).ready(function(){
$('#aExternalLink').click();
});
This way , this link will be automatically called in a new tab.
if you don't want to solve this by using JQuery. Here is Javascript Code
<script>
window.onload=function(){
var elem=document.getElementById("aExternalLink");
elem.click();
}
</script>

Can anybody help me out to open a link in new window / tab from pdf ?

I have generated a html using wkhtml library and I have a href link in the pdf which should open in either new tab or new window. I have already gone over using window.open() , window.location.href , javascript function and also directly href. But these not works for me. May be I am not using as in proper way. Please this will be great to get answer from anyone.
Try this:
Click here to view pdf in new tab
target="_blank" attribute opens the specified link new tab

adcash like site under pop up in new tab

i have seen adcash.com site under pop up/new page which is opened by every browser in new tab without any issues.i tried searching everywhere but could not find how to open a website in new tab without affecting the current webpage.
if you have used adcash.com site under script you might have noticed that when you click on next or any link one complete webpage will open in new tab and your present page will not at all affected.
plz help.i want to open ndtv.com in new tab not in new window but when users click on next page link that page should open there itself but ndtv.com should open in new tab.it means it has to work as usual and open next page in parent page plus new page in new tab.
According to what you said in the comments I think you are searching for something like this:
Click
What this will do is: Whenever you click "Click" it will go to where-you-want-to-go.php, and in the mean time it will open up google.com in a new tab.
Do two actions with one link.
<a target="_blank" href="http://www.google.com" data-location="http://www.example.com">Google</a>
$("a").on("click", function () {
window.location.href = $(this).data("location");
});

Iframe open page links in new tab

I just need one thing. How to make "iframe page" to open their links in new tab.
I try to add target="_blank" but I think that is not iframe attribute.
My code open one webcam site. I want, when someone click on "sign up" to be opened in new tab...
The only real solution is to either have target="_blank" bound to specific links, or if you control the page that you're loading in the iframe, making sure that page has a <base target="_blank"> element on it, which makes all a elements link through a new tab/window
What's wrong with target="_blank"? It works no matter where the link is.
do you mean " links that are in a page that is loaded in a iframe" ?
if so , I'm not sure such a thing exists in html 4 . it depends on browser I think . firefox , chrome , opera open _blank in new tab but IE opens it in new window

Google Chrome Extension

How do I open a link in a new tab in the extension HTML.
E.g.
clicks on icon
sees Google chrome window which has the window.html
inside there are two links, one link to open a link in a new tab, other in the original tab.
I used window.location, doesn't work like that.
If the page is indeed in a google chrome extension, you can force the browser to open the page in a new tab using javascript (which you know is enabled sine you are a google chrome extension).
chrome.tabs.create({url:"http://somewhere", selected:true});
Your extension will need the tabs permission.
See: http://code.google.com/chrome/extensions/tabs.html
I don't know why this question has two upvotes, but anyway you can try using the target attribute for anchor elements.
<a target="_blank" src="http://myFancyUrl">This is a link to a new tab</a>
However, it won't open in a new tab unless the user has the navigator configured that way (usually does).

Categories