Dharmesh patel
Dharmesh patel

Reputation: 654

How to close my single tab

I have a website in php(YII). I have a task of subscription renew in it by paypal. I have completed that task and after it i redirect link from paypal to "profile.php" named page.

My problem is - in some condition I want to close this tab. I have only single tab for this task, means no popup or child tab. I used for this task is :

window.close();
close();
window.top.close();

{
window.open('','_parent',''); 
window.close();
}

etc but it didn't work because i have only single tab. so please help me.

Thanks,

Upvotes: 0

Views: 43

Answers (1)

Antony
Antony

Reputation: 512

You may raise Ctrl+W event manually through javascript. this closes the tab in all the modern browsers(FF,GC,IE).

var evt = jQuery.Event("keypress");
evt.keyCode = 87; // w
evt.ctrlKey = true;
$(document).trigger(evt);

Upvotes: 1

Related Questions