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 CRM (Archived)

Web Resource is not loaded after visiting "Related" nav links

(0) ShareShare
ReportReport
Posted on by 135

I have a web resource that displays some additional info about the primary entity (Client).

The web resource is an HTML page with a DIV. The function that populates this resource is in a separate JS file, which is loaded as a library for the form and is called from the Form's OnLoad event.

It works just fine when the form is loaded or hard-refreshed(F5).

However, if the user visits any related links on the left and then comes back to the Main, the HTML page displays only empty div - the loaded information is gone, and Form's OnLoad event is not fired.

Question: what event of what object shall I hook up with (instead of Form's OnLoad) to make sure the Web Resource information is displayed correctly regardless of user's extra navigational trips?

I tried web resource's "body on load", but that one is called too often, whether it's needed or not...

The ideal solutions would be somehow keeping the info, which is lost (HTML reloaded w/o triggering Form's OnLoad) or, at least, ensuring that OnLoad is fired.

TIA

Nikolai

*This post is locked for comments

I have the same question (0)
  • ScottDurow Profile Picture
    21 on at

    Hi,

    That is strange, the form does not re-load when you move away and move back - does your html page have any event handlers in it for resize/lost focus? Try creating a simple html page with no dynamic javascript and see if the same happens for this.

  • DarthSLR Profile Picture
    135 on at

    Scott,

    that's the thing: the HTML page in question is as dummy as it can be, with just one DIV, no scripts, no no nothing.

    Again, the scenario is like that

    * entity opens from the list - form's OnLoad event fires, my function is called, populates the custom HTML div, everything is fine.

    * user temporarily goes to a related entity via one of the links on the left-hand side navigation panel

    * user comes back by clicking entity's Main link (where my web resource is)

    * the form's standard content is loaded ok, but the form's onLoad event is not triggered hence my DIV stays empty.

    Since DIV loses it content that was loaded during the first load I suggest another load actually takes place. But the OnLoad is not fired for some reason. Looks suspiciously like classic ASP.NET "isPostback" behavior, but what do I know...

  • ScottDurow Profile Picture
    21 on at

    When the user returns to the form, there isn't any post back - it simply shows the form that was hidden when the user clicked on the subgrid link. I've used many html web resources in this way before and they've not re-loaded - they just are made visible again with the same content as when the user left them. By design, the onload is not meant to fire since the form is not actually loading again - it's still in the same edit session as before.

    I'm wondering if you have some script that is being triggered somewhere that re-loads/clears the div. I suggest you use Fiddler to check the HTTP requests that are going on - also disable *all* of your custom JavaScript code and see if it still happens. If no (and it shouldn't!) you can then add your code back in bit by bit until you find the problem.

    hth

  • DarthSLR Profile Picture
    135 on at

    Scott,

    unfortunately there is  no other custom JavaScript code.

    However, when I tried to debug the problem and added onload handler to the web resource HTML's body tag, I noticed it's has been called on every navigational change (regardless if I navigate to this form or to something else), thus effectively "wiping out" the run time content I set during the Form's OnLoad.

    So, in essence, I know my WR is reloaded with every navigational move, yet the primary Form's OnLoad method doesn't fire (and yes, why should it).

    Now, how can I prevent WR from being reloaded (it's really not need to)?

  • Community Member Profile Picture
    on at

    Nikolai,

    I am experiencing the same issue. Did you find an answer?

    -Gene

  • DarthSLR Profile Picture
    135 on at

    Gene,

    I tried to look it up but it's been awhile, I cannot find what I did. Really sorry :(

    Nikolai

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans