Can I include an external HTML file into my web page? Answer: Yes, you can... here's how:

  • 2
  • Idea
  • Updated 8 years ago
Before reading any further... this tutorial requires that you have a Yola Premium Account to be able to host your javascript, CSS and HTML files in your file manager.

By now I think everyone knows how to include a .js and a .css file.

Javascript:
<script type="text/javascript" src="http://YourSite/resources/YourJavascriptFile.js"></script>

CSS:
<link rel="stylesheet" type="text/css"http://YourSite/resources/YourCssFile.css" />

Now... the HTML is a bit trickier but it can be done.
The easiest way, I found, is to convert it to a javascript file by doing a lot of document.write() statements. Sound like a lot of work? It would normally be, but I found this brilliant tool that does it all for you.

This HTML to JavaScript convertor takes your markup and converts it to a series of document.write() statements that you can use in a block of JavaScript.

1) Just save the file it produces to a text file and rename it to a .js
2) Upload the file to your file manager.
3) Using the Javascript linking method above, insert the script snippet in the normal flow of your HTML where you want it to appear.

Cool hey! Now you can host the javascript, CSS and HTML for those drop down menus and make all your changes globally. Plus... it should work great for updating you sites footer "site wide".

Check out my site here:
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes

Posted 9 years ago

  • 2
Photo of John McCarthy

John McCarthy

  • 1292 Posts
  • 99 Reply Likes
BOOOOOOOOMER
will it work for my sidebar
see this thread:
http://forum.yola.com/yola/topics/is_...
Thanks
John Mc
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
I had a quick look and I don't see a problem John.
Try converting from <ul id="menu"> to </ul>

<ul id="menu">
.
.
.
.
</ul>

Rename the file to a .js and save it to your file manager.
Insert <script type="text/javascript" src="http://YourSite/resources/YourJavascr...; where the code used to be.

Good luck!
Photo of John McCarthy

John McCarthy

  • 1292 Posts
  • 99 Reply Likes
HI boomer,i dont beleieve you understood me.
In the other thread there is a link to one of my games.
What i wanted to know if the sidebar next to the game could be used with this method
Thanks
John Mc
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
I'm talking about the sidebar to the right of the Piranha game.
Which one are you refering to?
Photo of John McCarthy

John McCarthy

  • 1292 Posts
  • 99 Reply Likes
i dont see the <!-- <ul id="menu"> -->in my sidebar code
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
Ok, John... can you post the code in your other thread and I will help you from there. Use this encoder when you post the code: http://forsite.synthasite.com/encoder...

P.S. Or even better, point me to where you got the sidebar code from.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
NIce one Boomer.

A rep posted a similar method a while back but without the converter - its really tempting to have site control of the menu but i dont think i'm going to use it for my main menu,

2 reasons, 1 if the browser has java disabled it wont show and 2, google wont read the pages as possible sitelinks.

But it is a great tool for other elemnets of pages - i will be using it somehow for sure.

You might know this Boomer, whats the URL you use for css, html and .js files when they are locating resources. I know that if you use the full url it will work to but i gues its already in the resources folder so it would find images etc. from after the resources directory. e.g filename,jpg rather than resources/filename.jpg

Anyway its just as easy to use a full URL.

Lee.
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
I always use the full URL because I have a few sites linking to one another and I want to make sure I'm accessing the right folder and file.
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
Could one of the Reps please point out this post to one of the technical guys.
I would like to know if it is acceptable practice to do things this way or if there is a better way. If this way is not acceptable practice, then this post can be deleted.
Thanks :-)
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
i'm sure it is good or normal practice but its not good for seo -- so it depends on the content whether its a good idea to use it or not.
Photo of lambofgod

lambofgod

  • 875 Posts
  • 35 Reply Likes
it's great especially since I don't want my members section to be indexed :)
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
Strange... Lee, but I've never had Google pick out text in my menu and display it in a search result - not that I have that many Google search results to go by.

Normally my headings are picked up and whatever relevent text associated with that heading or search query is displayed. (or otherwise my meta description is)

And... If a surfer has javascript disabled on their browser, most of my site isn't going to be viewable anyway.

For me, the ability to edit my menu site wide is a huge plus factor.
I'm doing a bit of site "housekeeping" before I change over to that wide rounded glass template. I'm making the changes now before I go any further :-)
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
@ Boomer, i dont mean the normal pages they link i mean these little sitelinks (the holy grail of links) - they take them from your main nav - Perhaps if you had footer links on every page they could read them as potential sitelinks.



@ Lambofgod

Nothing in the resources folder is crawled or indexed.
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
Hmm... ok I'll bear that in mind Lee, but here's the thing.
My internal pages drop down menu 's are different from the one on my home page.

The home page menu, I was planning to change on that page everytime anyway.
It's just all the other pages, where they are exactly the same, where this method of linking is a bonus. Which page does Google get the sitelinks from if the menu varies from page to page ??
Photo of John McCarthy

John McCarthy

  • 1292 Posts
  • 99 Reply Likes
Can i just say boomer.
Your great for finding this,changing every page so it includes this menu code.
I cant wait for it to be easier.
Im not particularly bothered about google links because my sites not listed very high so :P
Thanks
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
Hey Boomer, if you don't have a Yola Silver account, you can just host your JavaScript files on your own server. (Like me! I am hosting the stuff that can't be hosted on Yola free on a separate server) You can get free HTML website hosting from a lot of companies . Just letting you know.