Can i embed a html file from a GitHub repo directly in my html code using iframe or anything? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Can i embed a html file from a GitHub repo directly in my html code using iframe or anything?

I want to add a html file from a repo but the link doesn't return the file but the file opens from GitHub itself. How can i solve this prob?

5th Aug 2020, 5:30 AM
MSN
MSN - avatar
8 Answers
+ 1
🇧🇩Saadman Nuheen🇧🇩 really sorry. I didn't see that you wanted to embed *html code in an iframe* from github (don't know what's happening today). I thought you wanted to import a css or js file from github. I don't think you can show the code in an iframe because the html content is rendered in the browser and so there is no way you can get rendered html from github. Instead what you can do is get the code through javascript and then put it in the html to be rendered to the screen. See this https://code.sololearn.com/WAsU6tW6zNCn/?ref=app Try adding something in your html file at the url or change the url to see it
5th Aug 2020, 10:12 AM
XXX
XXX - avatar
+ 3
Ok let me try....
5th Aug 2020, 5:37 AM
MSN
MSN - avatar
+ 3
XXX See this: https://code.sololearn.com/WnzoE9Y9xP7f/?ref=app why is it giving an error?
5th Aug 2020, 5:43 AM
MSN
MSN - avatar
+ 3
Mahdee Mohammad I know but uploading the files to dropbox is the last solution i needed. I need to know how can i do it from github. https://code.sololearn.com/WnzoE9Y9xP7f/?ref=app This method is showing an error too.
5th Aug 2020, 6:04 AM
MSN
MSN - avatar
+ 2
First make sure that the repo is public so that the files can be accessed from your code. Then you go to the file on the GitHub website. There you will see an option: "View Raw". Click on that. You will be redirected to another page where you'll see the raw code. Just copy the link of that page and paste it in your code.
5th Aug 2020, 5:36 AM
XXX
XXX - avatar
+ 2
well, you can do it by uploading it to dropbox. I never tried yet, but you give it a try, hope it'll work.
5th Aug 2020, 6:01 AM
Mahdee Mohammad
Mahdee Mohammad - avatar
5th Aug 2020, 6:02 AM
Mahdee Mohammad
Mahdee Mohammad - avatar
- 2
Hi
5th Aug 2020, 1:58 PM
علي علي
علي علي - avatar