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.
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.
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.
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?
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
Hi,
Look up the X-Frame-Options - you put this in your web.config (of the serving site).
Hi!
Is this still working? I thought ALLOW-FROM is deprecated, and ignored by latest browsers.
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!?
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.
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.
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?
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.
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
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
is working on a reply...