locked
HTML Webresource display webpage from url stored in a field on form? RRS feed

  • Question

  • Hi everyone,

    I have a text field "new_url" that stores a URL. For e.g. www.bing.com

    I have a html web resource on the same form called "new_html".

    I would like the html web resource to take the url stored in "new_url" so it displays the webpage on the form.

    My code so far for the new_html webresource is:

    <html><head>
    <title>Test</title>
    <script type="text/javascript">
    
    var url = window.parent.Xrm.Page.getAttribute("new_url").getValue();.
    window.parent.Xrm.Page.getControl("new_html").setValue(url);
    
    </script>
    </head>
    <body>
    </body>
    </html>

    Very simple but what stupid mistake am I doing?

    Many Thanks.

    Saturday, July 26, 2014 9:07 AM

All replies

  • Hi,

    You can have a iframe control instead of webresource control.

    You can write a javascript to set iframe source on the load of the form.

    Xrm.Page.getControl ("iframeid").setSrc(url);

    HTH!

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful 

    Saturday, July 26, 2014 9:35 AM
  • Hi DynaDeveloper,

    Many thanks for your reply. I will try out the IFRAME but this must also be possible using the HTML web resource?

    Saturday, July 26, 2014 9:45 AM
  • Hi,

    Yes, this is definitely possible using Web Resource. You can fetch the URL stored in the form field from the Web Resource by the following script:

    window.parent.Xrm.Page.getAttribute("your_field_name").getValue();

    Once you have the URL, it's up to you what you wish to do with the URL.


    Admin QuikView Solution for CRM 2013

    Saturday, July 26, 2014 11:52 AM
  • Hi,

    Yes, you can use html webresource as well. Please try below code,

    var url = window.parent.Xrm.Page.getAttribute("new_url").getValue();.
    window
    .location=url;

    HTH!

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful 

    Saturday, July 26, 2014 1:19 PM
  • Hi Davdatong,

    Does it work?


    Wednesday, July 30, 2014 10:12 AM