Including r-markdown generated html via iFrame

I’m trying to include html code (including JS) generated by r-markdown into my website using an iFrame. The html is auto-generated, but mostly self-contained & well-behaving. However, since I can’t directly upload it to wix and don’t want to rely external hosting of the html file, I’m now trying to get the code into an iFrame.

From what I’ve read so far, iFrames should work with fully self-contained code (which I have, though it may also load some external things like mathjax), but can also be tricky since it doesn’t work with all possible options.

My code has several sections (in body & head), as well as the actual tables using &

tags for proper formatting. Since the tables will show a lot of data in the end the full size of the html is ~8.5Mb (which may also be a problem - the wix editor always freezes a bit when I try to copy all of that into it). I’ve attached an example html with less data but the same formatting.

Does anyone have suggestions on how to get the code working in the iFrame? I’ve also tried to look into using corvid to load parts of the JS code, but that seemed to just produce more problems.

So assuming that you’ve seen this page already.
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site

Simple answer is that you might just find that Wix doesn’t like the markdown and it all has to be as html.

See this page here for example.
http://www.elliothenry.com/r-markdown-to-website/

Plus as you’ve mentioned, you can use Wix code to pass data to and from a html component to your page etc.
https://support.wix.com/en/article/corvid-working-with-the-html-element
https://www.wix.com/corvid/reference/$w.HtmlComponent.html

Thanks for the answer.

I have read the page about iFrames and it’s the main reason, that I think what I want to do should work in principle:

  • I have an html file (including also JS and CSS parts) that was generated using markdown (it doesn’t use or contain markdown anymore), which works as-is both locally and hosted on an external server.
  • My goal is to NOT rely on external hosting of the file I already have and instead implement its content into wix (as I can’t upload the html itself to wix).
  • Since the content of what I want to show is fixed, I don’t think I’ll need to send data to the html component. The only reason to do so, would be if I can’t hardcode all data into the iFrame itself (i.e. because it’s too much).

Currently just copying the html source code I have into the iFrame doesn’t work and I’m not sure why:

  • my html source code is very big (~8.5Mb), the editor says there are no size restrictions, but maybe it’s causing problems anyway?
  • I’m not sure if there are any html tags / JS- parts that won’t work, apart from the specifically listed ones (, , ), which I do not have in the code. (Some other forum posts mentioned
    tags may not work in iFrames?)
  • I checked the JS functions in the html again and some of them load additional stuff from the web (i.e. xml styles) and not all of these are using https, could that break the whole thing?

Some observations and thoughts:

  • The HtmlComponent does support

    tags.

  • I don’t know what the “additional stuff” is, but that might be the problem. You’ll need to check this out.

  • All you’ve said about the script is that it “doesn’t work”. What doesn’t work? Have you tried opening the browser’s developer’s console to see what messages you’re getting?

Note: Adding code to an HTML component is not a part of the Corvid product (which is what this forum is about). The basics of an HTML component is to put any HTML code in it. That code can be copied from any source that you want, but you’ll need to figure out how to get it to work (which is not related to Corvid)… Your best option is to contact the service provider to find out what you need to get the script to work.

Again thanks for the answer.

The reason I posted here, was mianly that the wix support suggested this, they probably misunderstood my problem though and thought I had problems writing code - I’ll try contacting them again.

As for how my code doesn’t work: it just doesn’t show anything - the iFrame remains grey. I tried to investigate using dev tools of the browser but that doesn’t give me anything either (but this is on the preview page not published, so that may affect it).
I’ve also pasted the code both into the test field on Wix Editor: Embedding a Site or a Widget | Help Center | Wix.com (neither any output nor errors) and https://jsbin.com (works fine)

Wix support won’t be able to provide any assistance as third party scripts are not considered part of the Corvid or Wix product. You will need to consult with the provider of the script.

The script/html code is auto-generated and runs fine (essentially I am the provider) - it just stops working the moment I try to implement it in wix

Well then, the only thing I can recommend is using the browser’s development tools. See the browser’s development console for error (and other messages). It shouldn’t matter whether you are in Preview or Live - the dev console always always displays an amazing number of messages.

Since you are generating the HTML, you should have a good idea what’s in it. You’ll need to review the generator and the generated code itself to see if there’s anything wonky in there.

You did mention that you link to external files. That means that you aren’t the sole provider. What are those files? Who do they belong to? You will need to find out what they do and what’s in them. Maybe consult with the providers of those files?

Thanks for all the comments.

I am now sure that the iFrame is not able to handle the code I’m trying to paste in (I guess due to size problems? I’ll ask the support about this):

  • Like I said there are no error messages relating to my code in the dev console (the few that are there either refer to a function called promote-analytics-adapter or frog.wix.com).
  • Additionally the ‘Inspect Element’ function of the dev tools shows me that both body & head of the iFrame (in the site preview) are empty
  • After more testing it seems that it tries to save what I paste in, but silently drops everything once I close the ‘enter code’ element

Hi Nicolai
I am trying to do the same thing and run into the same issue.
Have you managed to solve the problem?