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
Sid_CSid_C 

Detecting Console in Home Page Component VF Page?

Does anyone know a way to detect console mode from a home page component (VF Page)? We have a visual force page, added as a wide home page component. Within the page JS, we are trying to detect whether the page is in console using "sforce.console.isInConsole()". But this does not seem to work. Any suggestions?

Best Answer chosen by Sid_C
Sid_CSid_C

The issue was with the page url being set in the home page component. We were earlier using 
<iframe src="/apex/SamplePage?core.apexpages.devmode.url=1" id="samplePage" width="100%" frameborder="0" height="100"></iframe>.

So the SamplePage JS, always assumed the page to be in non-console mode.

The fix was to check within the wide-component JS if we were in console mode. If so then add "&isdtp=vw" to the url, and then display in the iframe. This way the IsInConsole function in the SamplePage JS worked fine.

 

Hope this helps anyone else facing this issue.

 

All Answers

Bradley DelauneBradley Delaune
Sid_C, could you provide your code?  Need to make sure you're using sforce.console.isInConsole() correctly.  Javascript tends to be very sensitive, especially in IE.

Thanks
Sid_CSid_C

The issue was with the page url being set in the home page component. We were earlier using 
<iframe src="/apex/SamplePage?core.apexpages.devmode.url=1" id="samplePage" width="100%" frameborder="0" height="100"></iframe>.

So the SamplePage JS, always assumed the page to be in non-console mode.

The fix was to check within the wide-component JS if we were in console mode. If so then add "&isdtp=vw" to the url, and then display in the iframe. This way the IsInConsole function in the SamplePage JS worked fine.

 

Hope this helps anyone else facing this issue.

 

This was selected as the best answer