Reason: Telerik RadHtmlPlaceholder control for Silverlight refuses to open certain Websites


Yesterday while working with Telerik’s RadHtmlPlaceholder control for Silverlight, I noticed that, it is unable to open certain websites and showing a message that says “The content cannot be displayed in a Frame”.

 

After doing an investigation, I came to know that, it is default behaviour of the control we can not handle. Let’s discuss more on the issue and the reason behind it.

 

What is the Issue?

While working with the Telerik RadHtmlPlaceholder control in a Silverlight application I noticed that, most of the websites are opening inside the control but few are not though they are very reputed websites. For example, I am able to open www.bing.com but in case of www.google.com it is just showing a message that says “The content cannot be displayed in a Frame”.

 

I didn’t find any specific reason behind blocking those sites in the RadHtmlPlaceholder as my implementation was just simple as this:

 
 
<Grid x:Name="LayoutRoot" Background="White">
    <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <telerik:RadHtmlPlaceholder SourceUrl="http://www.bing.com" 
                                    Width="600" Height="400"/>
    </Border>
</Grid>

 

The above XAML code properly opened the bing search page in the control inside by Silverlight application:

 

Bing opens properly in RadHtmlPlaceholder

 

But when I tried by replacing just the SourceUrl of the RadHtmlPlaceholder control like this:

 
<Grid x:Name="LayoutRoot" Background="White">
    <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <telerik:RadHtmlPlaceholder SourceUrl="http://www.google.com" 
                                    Width="600" Height="400"/>
    </Border>
</Grid>

 

The control was unable to open it and was showing the following message in the page:

 

Unable to open Google in RadHtmlPlaceholder

 

The message itself says that, it is not able to open the site in the control as the site publisher is not allowing to display their content in a Frame. Though the message was simpler but as a developer I wanted to know more about it. Also, I wanted to know if there are any ways to handle such types of message and show the user a proper message. So, there my investigation started on this issue.

 

Reason behind it

After doing a lot of investigation, I came to know that, the RadHtmlPlaceholder displays all external pages in an IFrame object on top of the Silverlight plug-in. However, Google and few other sites are currently preventing all their pages from displaying in IFrame object. There are no other ways to control those pages display over the IFrame at the moment. Also there are no other approaches for displaying external pages in the RadHtmlPlaceholder.

 

When contacted with the Telerik team, I got the same message from them and they clearly mentioned that, they are not aware of any other alternative ways to show such web pages. Also they don’t have any control over IFrame to take next steps to show a proper message to the user like “404 Not Found page”, as the IFrame does not provide such APIs to the developers.

 

So, if you came across the same scenario and looking for an alternate way to show a custom page to the user, the simplest answer is “No, you can not do this” unless IFrame or the RadHtmlPlaceholder control provides some APIs to you. Share this information to your client if they are pushing you to implement it in your application. And yes, hope for the best to have the APIs in the future.


2 comments

  1. Kunal,

    What experience have you had with the RadHtmlPlaceholder and IE9 inside Silverlight 5 plugin ofcourse. We have a site and I think because of the external javascript refuses to load. Any thoughts? It works fine in Chrome and Firefox.
    Also do you have any suggestions for clipping the RadHtmlPlaceholder control. We are about to just throw it out completely and write our own so we can control clipping. Thoughts.

    Thanks

    ReplyDelete
    Replies
    1. We can not directly control RadHtmlPlaceHolder as it internally uses IFrame. You can not clip that control. Unless the underlying framework provides something additional, this is really difficult.

      Delete


 
© 2008-2014 Kunal-Chowdhury.com | Designed by Kunal Chowdhury
Back to top