Hello, I want js code to open new tab on 2nd click. I have a code. On first click it opens a new tab but after 3 second a new tab automatically opens. I want to open 2nd tab also on click after 3 seconds, not automatically. Here is my code:
<script> $(window).one('click',function() { var url = "https://google.com"; window.open(url, "_blank"); setTimeout(function(){ window.open(url, "_blank")}, 3000); }) </script>js code for new tab
Started on the old forum in July 2018 · view the original in the archive · old links redirect here
Hello, I want js code to open new tab on 2nd click. I have a code. On first click it opens a new tab but after 3 second a new tab automatically opens. I want to open 2nd tab also on click after 3 seconds, not automatically. Here is my code:
Try the following
$(window).one('click',function() {
var url = "https://google.com";
[COLOR=#691c97]window[/COLOR].[COLOR=#693a17]open[/COLOR]([COLOR=#0b6125]url[/COLOR],[COLOR=#0b6125]'_blank'[/COLOR]);
}
Want something coded email me at sales@webnwaphost.com for a prices.
omshankar wrote: Hello, I want js code to open new tab on 2nd click. I have a code. On first click it opens a new tab but after 3 second a new tab automatically opens. I want to open 2nd tab also on click after 3 seconds, not automatically. Here is my code:
Try the following
$(window).one('click',function() { var url = "https://google.com"; window.open(url,'_blank'); }
it opens single popup in new tab. I want 2nd popup in new tab on clicking after 3 second. It should not be opened automatically. It should be opened after clicking.
Something like:
<script>
var x = 1;
$(window).on('click',function()
{
if(x==2)
{
var url = "https://google.com";
window.open(url, "_blank");
setTimeout(function(){ window.open(url, "_blank")}, 3000);
}
x++;
})
</script>
something else wrote: Something like:
<script> var x = 1; $(window).on('click',function() { if(x==2) { var url = "https://google.com"; window.open(url, "_blank"); setTimeout(function(){ window.open(url, "_blank")}, 3000); } x++; }) </script>
This code also opens 2nd popup automatically. 1st popup opens on clicking. but 2nd popup opens automatically. I want 2nd popup should also open on clicking after 3 seconds.
its not clear what you are after .... Maybe this:
<script>
var x = 1;
$(window).on('click',function()
{
if(x==1)
{
var url = "https://google.com";
setTimeout(function(){ window.open(url, "_blank")}, 3000);
}
if(x==2)
{
var secondUrl = "https://google.com";
setTimeout(function(){ window.open(secondUrl, "_blank")}, 3000);
}
x++;
})
</script>
if this isn't right can you write a process list of what you would like to happen.. eg:
page loads.. first click wait 3 seconds open popup second click wait 3 seconds open second popup
Yes, This didn't work properly. Process is like this:
Page loads first click open popup (due to clicking) wait 3 seconds second click open second popup (due to second click)
Popups should not open automatically. When I click on the page then due to clicking popup should open. Like pops of adnetworks like propeller, adcash works. i.e when you click on the page then popup opens, not automatically.
Edit: Even if I wait on that page for more than 3 seconds, popup should not open automatically. When I click after 3 seconds (may be after 20 seconds) then popup should open.
I think this is what you are after:
<script>
var x = 0;
$(window).on('click',function()
{
if(x==0)
{
var url = "https://google.com";
window.open(url, "_blank")
x++;
setTimeout(function(){ x++; }, 3000);
}
if(x==2)
{
var secondUrl = "https://google.com";
window.open(secondUrl, "_blank");
x++;
}
})
</script>