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
mnknmnkn 

iframe on home screen

Hi all,

 

first I want to explain the situation:

I want to add a list of records for a specific object on the home page.

The list should be sortable by all columns and if i click on a record, it should take me to the detail page.

 

So I created a Custom Home Page Component, that I want to fill with a "apex:listViews".

Full code for my vf page is here (Time_Sheet__c is my custom object):

<apex:page showHeader="false" sidebar="false">
  <apex:listViews type="Time_Sheet__c"/>
</apex:page>

 

After that I added an iframe to my html custom component:

<iframe id="timeSheetList" src="/apex/Time_Sheet_List_View" width="100%" frameborder="0" height="350"></iframe>

After that i have a list appearing on my home page.

So everything is correct, right?

No!

Because if I click a record Id/Name in the list, it will open it in the iframe.

But I want the surrounding page to load the record detail page.

I added the onload-Attribut to the iframe tag:

onload="changeLocation(this.contentWindow.location);"

 So it will execute following code AFTER it has loaded the detail page:

function changeLocation ( newUrl ) {
  window.location = newUrl;  
}

But this means, that it will load the page in the iframe and then changes the browser location.

The strange thing is, that if I am in development mode, it opens the page in the surrounding window automatically and not in the iframe.

I am not happy with the current solution.

Is there any possibility to rebuild the functionality from the development view?

 

Thanks in advance

sfdcfoxsfdcfox
You could probably just add a <base target="_top"/> directive near the top. That should cause it to work. Development mode is notorious for changing the behavior of JavaScript especially as it relates to manipulating windows/frames.
SSamiSSami

Hi,

 

I'm in the same situation with slight variation.

I have a list of records and a command button.

my requirement is: when I click on commandbutton, it should open in iFrame section, and

when I click on any of the record, it should open in the next window.

 

Using <base taeget="_top"> every thing I click on iFrame section, opens in new window.