Asked by:
Refresh IFrame only Once - Dynamics CRM 2013

Question
-
Hi all,
Is there any javascript code that refreshes the Iframe only once?
I am trying the setInterval but it get refreshes all the time.
Can anyone help me please?
Many Thanks
Regadrs
Vinay
Thursday, November 28, 2013 6:16 AM
All replies
-
HI Vinay,
Add another attribute for the check. First time set its value to 0. and after that set its value to 1. And in your code add condition that If check value is equal to 0 then refresh else nothing.
:)
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Mubasher Sharif
Check out my about.me profile!
http://mubashersharif.blogspot.com
Linked-In Profile
Follow me on Twitter!Thursday, November 28, 2013 6:21 AM -
Hello,
Please share your entire code.
Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
Vikram Singh. !!! My BlogThursday, November 28, 2013 6:25 AM -
Hi,
Please find my code below:
function Frame_change()
{
var spurl=Xrm.Page.getAttribute("new_sharepointurl").getValue();
var IFrame = Xrm.Page.ui.controls.get("IFRAME_SPoint");
IFrame.setSrc(spurl);
}
function Form_onLoad()
{
setInterval("Frame_change()", 200000);
}
As suggested by Mubasher, if i load the form again, it won't work.
Any help would be appreciated.
Many Thanks
Regards
Vinay
Thursday, November 28, 2013 7:03 AM -
Try to attach following Form_OnLoad function on Form Onload event handler :
function Form_OnLoad() {
if (Xrm.Page.ui.getFormType() == 2) {
if (Xrm.Page.ui.controls.get("IFRAME_SPoint")) {
var spurl = Xrm.Page.getAttribute("new_sharepointurl").getValue();
var IFrame = Xrm.Page.ui.controls.get("IFRAME_SPoint");
IFrame.setSrc(spurl);
}
else {
setTimeout("Form_OnLoad();", 2000);
}
}
}Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
Vikram Singh. !!! My BlogThursday, November 28, 2013 7:21 AM -
Hi Vikram,
I have tried ur code.
But nothing happen. My IFrame don't get loaded.
Any idea?
Regards
Vinay
Thursday, November 28, 2013 7:55 AM -
Hi Vinay,
Above code sample would work only existing records. have you tried to open existing record ?
Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
Vikram Singh. !!! My BlogThursday, November 28, 2013 8:10 AM -
Hi Vikram,
Yes I have tried it on existing record itself.
It seems that setSrc doesnt work.
Does it work at your end?
Regards
vinay
Thursday, November 28, 2013 8:30 AM -
I tried and seems not to be working :( !
Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
Vikram Singh. !!! My BlogThursday, November 28, 2013 8:55 AM -
I asked this question many weeks ago and I've been experimenting with different methods to get an IFrame to refresh. I don't know if CRM 2013 is buggy (I have found many) but my final solution was to include an interval counter inside the HTML file that needs to be displayed in the Iframe. This is what I used:
function activityTimer() {
setTimeout(function() {
i++;
if (i > 0) {
activityTimer();
Information();
}
}, 10000);
}
activityTimer();The above function just calls the Information() which reloads data on the HTML page, and the function is called again, every 10 seconds. This way I see no blink or refresh.
Thursday, November 28, 2013 9:05 AM -
Hi Syed,
I am calling a SharePoint Library page.
Where should i include the function?
Can I set the Iframe source using a plugin?
Any help is appreciated.
Many Thanks
Regards
Vinay
Thursday, November 28, 2013 1:16 PM -
Hi,
I had the same issue about setting src on a iframe on the form load event.
I just use "setTimeOut" instead of "setInterval", and it worked for me.
It's a little dirty, still, but getting around the CRM13 load form event issue ..
setTimeout('method()', 1000);
Regards.
V.
Tuesday, December 17, 2013 6:21 PM -
This did the trick for me :
document.getElementById("[Your Iframe ID]").src = Xrm.Page.getControl("[Your Iframe ID]").getSrc();
- Edited by Ciprian_FOM Monday, November 2, 2015 3:55 PM formatting
Thursday, September 11, 2014 3:14 PM -
Just a note, this is one of the many working examples of code that isn't supported by microsoft.
Ciprian, does this work?var iFrame = Xrm.Page.getControl("[iframe name]"); iFrame.setSrc(iFrame.getSrc());
Monday, February 27, 2017 2:53 PM