function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vijaymindvijaymind 

window.open in partner portal not open in parent URL

Hi All,

 

I have a simple JS function.

function openNewVfpage(){
window.open('/apex/GRID_portalSearch?searchText='+document.getElementById('{!$Component.formId.SearchKeyWord}').value,'_parent');

return true;
}

 

it working in salesforce when I am clicking on button. but in portal I am using the same VF page and clicking on button and it opens only

https://c.cs12.visual.force.com/apex/GRID_portalSearch

but I need this URL with the parameter  ?searchText=value

it should be  

https://c.cs12.visual.force.com/apex/GRID_portalSearch?searchText=value

 

can anyone please help me out ?

 

Thanks

Vijay

 

 

Bhawani SharmaBhawani Sharma
Can you check the javascript console to check if you are getting any error?
vijaymindvijaymind

Thanks for reply

Already I checked , there is no error in console. Even if error occured then it will be in salesforce VF page it self.

Bhawani SharmaBhawani Sharma
Alert box is working ?
vijaymindvijaymind

Yes I had fix some alerts as well , and I am getting the exact URL in alert before calling it in window.open.

 

 

Bhawani SharmaBhawani Sharma
This is really odd. Did you try with hardcoded searchText? like
?searchtext=Test
vijaymindvijaymind

Yes Bhawani,

 

Almost I checked every probality even I tried to check other properties of windows like window.location.heref and all others but still not work. Ok fine.

 

Now again I am trying to write another button code and will try to open some other hard coded URL and lets see what happens. I know it is silly work but still some time we used to do :)

 

vijaymindvijaymind

Its not working , I understood the problem. I have another commandLink or button on Portal Header as VF page in Iframe if I am clicking from header part it works for window.open but if we are in the portal VF page then the same code doesnot override the parent URL. 

Bhawani SharmaBhawani Sharma
Okay..
Also did you try with parent.location.href?
vijaymindvijaymind

Yes , I wrote in my previsous reply.

 

 

Bhawani SharmaBhawani Sharma
Surprised, why it's not working. I will try this my self and will getback to you
vijaymindvijaymind

Thanks.

vijaymindvijaymind

 

I have done my job using pagereference method. But still it should work with window.open.