Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simeon Ostberg 96 posts 341 karma points
    Aug 28, 2020 @ 09:16
    Simeon Ostberg
    0

    How to embed page into iFrame?

    Hi everyone,

    I would like to embed an Umbraco site into an iFrame, but the Umbraco page is blocking being embedded. What could I do to make it work? Both are Umbraco sites in the same installation, but with different domains.

    Best, Simeon

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Aug 28, 2020 @ 14:38
    Steve Morgan
    0

    Hi,

    Look up the X-Frame-Options - you put this in your web.config (of the serving site).

    <httpProtocol>
    <customHeaders>
      <add name="X-Frame-Options" value="ALLOW-FROM https://domain.com" />
    </customHeaders>
    

  • Simeon Ostberg 96 posts 341 karma points
    Aug 28, 2020 @ 15:26
    Simeon Ostberg
    0

    Hi!

    Is this still working? I thought ALLOW-FROM is deprecated, and ignored by latest browsers.

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Aug 28, 2020 @ 16:56
    Steve Morgan
    0

    So it is.

    Could you do something server side - call the page on site a, scrape the html and render it on your site b? Heavily caching of course.

    EDIT: - just noticed this is on the same installation... should be really easy just to get the content!?

  • Simeon Ostberg 96 posts 341 karma points
    Aug 31, 2020 @ 07:38
    Simeon Ostberg
    0

    Hi Steve,

    Sorry, I don't understand your first sentence.

    Yes, it's the same installation, but only the content wouldn't work (without a heavy load of work), as this are 2 different sites with 2 completely different templates incl. CSS.

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Sep 01, 2020 @ 07:32
    Steve Morgan
    0

    Hi,

    If all you need to do is render some content from the other site you're going to find it easiest to just to "get" the content via a query within the View or a partial view.

    @{
        Layout = "Master.cshtml";
    
        var siteANewsRoot = Umbraco.Content(Guid.Parse("ca4249ed-2b23-4337-b522-63cabe5587d1")); // put the node id of Site A News folder here
    
        var newsArticlesFromSiteA = siteANewsRoot.Descendants<NewsPage>().Where(x => x.ContentType.Alias == "newsPage");
    
        @foreach(var curNewsArticle in newsArticlesFromSiteA)
        {
            <p>@curNewsArticle.Name</p>
        }
    }
    

    This would obviously give you a raw access to the content data without the html and css.

    What exactly are you trying to achieve though?

  • Simeon Ostberg 96 posts 341 karma points
    Sep 01, 2020 @ 08:50
    Simeon Ostberg
    0

    Hi Steve,

    I would like to use this page element: https://www.soundtrackcologne.de/en/archive/soundtrack_cologne-16/congress-program/?mainbody=1 (Not the PDF link) in another site: https://www.soundtrackzurich.com/

    I don't have an schedule element in the template we used for soundtrackzurich.com (by the time I built this site, this was not necessary).

    And I would like to avoid creating this element in the new template.

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Sep 01, 2020 @ 09:55
    Steve Morgan
    0

    Hi,

    Seems to me your choices are to either scrape the html and re-render it trying to strip the header and and footer whilst bringing in the css and js but not having it conflict with your other site. OR: just create a new partial view, copy the markup logic from your other site and just bring in the necessary css and js to your site b manually.

    Forgive my ignorance but it looks like a trivial job to just do the partial view that generates this element - what work are you trying to avoid exactly?

    Steve

  • Simeon Ostberg 96 posts 341 karma points
    Sep 09, 2020 @ 14:36
    Simeon Ostberg
    0

    Hi Steve,

    Please excuse my late reply! I will try to recreate the partial and not use embedding. I thought it would be easier, but obviously it's not...

    Thanks! Simeon

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies