When you insert an IFrame in a form, the form designer forces you to enter a blank URL. Before Polaris (UR12) we could enter “about:blank” and we’re all set! However, you are now forced to enter a URL with a valid prefix (http, https, ftp, fttps):
If your IFrame will embed external web pages (such as www.bing.com ) then it is not a problem to enter the default URL and have the script modify the URL if required at run time. However, if your IFrame is used to display HTML pages that you have defined as CRM Web Resources then you will not want to enter the full URL (e.g. http://mydevcrmserver.com/myorg/WebResources/test.html ) because the URL would contain a link to your DEV organization and that means that every time you promote to test/prod or install the solution on a different server, you’d have to go and modify the URL manually. So what can you do?
One option is to set the defaul URL to some hard-coded external website (e.g. http://www.bing.com) and have your script update the URL at runtime so the IFrame loads your HTML web resource. Ugly!
The best option would probably be that Microsoft allows as to enter “about:blank” but it seems this is no longer allowed after UR12 (hopefully they will allow it in the future). But you don’t want to rely on that.
The second best option that should work for you is to define your own “blank” web resource (Thanks to Alex Ries for the suggestion):
- Create a new HTML web resource, which is blank (<HTML/>)
- In your form, instead of inserting an IFrame, insert a web resource and use your blank web resource you just created.
- At run time, your script should still be able to modify the URL of your web resource to point to another web resource. The setSrc() method is supported on IFrame as well as web resource controls!
With this solution, you are no longer using an IFrame so you are not forced to set a default URL! Hope this helps you!
Great article, didn't know this about UR12.
ReplyDeleteHowever, you mean about:blank right, not auto:blank?
Hi Peter, you're right, thanks for the correction
ReplyDeletenice knowledge sharing
ReplyDeleteabout:blank seems to be working as of UR 13
ReplyDeleteYes, thanks to our feedback ;-)
ReplyDeleteCan we show that blank html if the specified Iframe URL is not available.
ReplyDelete