web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to prevent Dashboard web-resource / IFRAME Refresh on window resize

(4) ShareShare
ReportReport
Posted on by 9
MS Dynamics refreshes a iframe embedded inside it on window resize and as a result all user interactions/activities user has done inside the iframe goes away. Has anyone able to resolve this known issue yet? Thank you
I have the same question (0)
  • Verified answer
    Daivat Vartak (v-9davar) Profile Picture
    7,835 Super User 2025 Season 2 on at
    Hello PG-12031439-0,
     
    You've accurately described a long-standing and frustrating issue with iframes embedded within Dynamics 365 forms: the automatic refresh on window resize, leading to the loss of user interactions and activities. This is indeed a well-known problem and, unfortunately, there isn't a perfect, officially supported solution from Microsoft.
    Here's a breakdown of the issue and potential workarounds:
     
    Understanding the Problem:
    • Dynamics 365 Rendering:
      • Dynamics 365's rendering engine automatically triggers an iframe refresh when the browser window is resized.
      • This refresh is intended to ensure that the iframe content adapts to the new window dimensions.
    • Iframe Limitations:
      • Iframes are isolated environments. When they are refreshed, their internal state is reset, resulting in the loss of any user interactions or data entered within them.
    • User Experience Impact:
      • This behavior can significantly disrupt the user experience, especially if users are working with complex forms or applications embedded within the iframe.
     
    Workarounds and Potential Solutions:
    1. Preventing Window Resizing (Not Recommended):
      • While technically possible using JavaScript, preventing window resizing is generally not a good user experience.
      • It also doesn't address the underlying issue, as other events might trigger the iframe refresh.
      • This is generally a very bad idea.
    2. Saving Iframe State (Recommended):
      • The most effective approach is to implement a mechanism to save the iframe's state before the refresh and restore it afterward.
      • Implementation:
        • JavaScript Communication: Use JavaScript to establish communication between the Dynamics 365 form and the iframe content.
        • State Storage:
          • When the Dynamics 365 form detects a window resize event, use JavaScript to capture the current state of the iframe (e.g., form data, scroll position).
          • Store the state in a temporary location, such as:
            • Browser local storage.
            • Session storage.
            • A hidden field on the Dynamics 365 form.
        • State Restoration:
          • After the iframe refresh, use JavaScript to retrieve the stored state and restore it to the iframe content.
      • Advantages:
        • Provides a relatively seamless user experience.
        • Preserves user interactions and data.
      • Disadvantages:
        • Requires JavaScript development.
        • Can be complex to implement for complex iframes.
    3. Using PCF Controls (Power Apps Component Framework):
      • PCF controls offer more control over the rendering and behavior of custom components within Dynamics 365.
      • Implementation:
        • Create a custom PCF control that replicates the functionality of your iframe.
        • Implement state management within the PCF control.
      • Advantages:
        • Provides a more robust and integrated solution.
        • Offers better performance.
      • Disadvantages:
        • Requires PCF development skills.
        • Can be more complex to develop than a simple iframe solution.
    4. Avoiding Iframes (Best Long Term Solution):
      • The most reliable solution is to avoid using iframes altogether.
      • Alternatives:
        • Rebuild the iframe content as a native Dynamics 365 component using PCF controls or web resources.
        • Integrate the iframe functionality using server-side APIs and client-side JavaScript.
      • Advantages:
        • Eliminates the iframe refresh issue.
        • Provides a more integrated and performant user experience.
      • Disadvantages:
        • Requires significant development effort.
        • May not be feasible for all use cases.
     
    Key Recommendations:
    • Save Iframe State: This is the most practical workaround for most use cases.
    • Consider PCF Controls: If you need a more robust and integrated solution, explore PCF controls.
    • Avoid Iframes: If possible, avoid using iframes altogether for a long term solution.
     
    Important Notes:
    • The specific implementation of state saving and restoration will depend on the content and functionality of your iframe.
    • Thoroughly test your solution in different browsers and window sizes.
     
    While there is no perfect out of the box solution, these workarounds will help you mitigate the iframe refresh issue and provide a better user experience.
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Best Regards,
    Daivat Vartak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans