+ Start a Discussion
Subhrajyoti NathSubhrajyoti Nath 

Open a tab in same window

How to open a tab in a same window using javascript
rathore_1987rathore_1987
Use 
target="_blank";

Hope this will resolve your issue.

Cheers,
Kuldeep
Arunkumar RArunkumar R
Hi,

You can use to below function to open in same window/tab
 
​ window.location.href = 'https://www.google.com'
Subhrajyoti NathSubhrajyoti Nath
I have tried all this but none of it works
Subhrajyoti NathSubhrajyoti Nath
This is my visualforce page

User-added image
when i will click exit button it should redirect me to the home page in the same tab

User-added image 
 
Gaurav_SrivastavaGaurav_Srivastava
Hi,

Use below code:

<script>
function onClickHandler()
{
var domainURL = '{!LEFT($CurrentPage.URL,FIND('/',$CurrentPage.URL,9))}';
window.top.location = domainURL + 'home/home.jsp';
}
</script>

<apex:commandButton onclick="onClickHandler();return false;" value="Exit"/>

Thanks,
Gaurav 
Muthuraj TMuthuraj T
<apex:form>
      <apex:commandButton value="Exit" onclick="window.location='/'" reRender="none"  />
</apex:form>

Hi, Please try like the above code.
Arunkumar RArunkumar R
Hi,

can u try the below code,
 
<apex:page>
<script>
function load(){
    window.open("/home/home.jsp", "_self");
 }
 </script>
 <apex:form> 
     <apex:commandButton value="Close" oncomplete="load();"/> 
 </apex:form> 
 
</apex:page>