...

View Full Version : Best way to include an html file with JavaScript



MeltingDog
05-24-2012, 02:05 AM
Hi all,

I am trying to find a way to include a .html file in my client side only site (say for example: header.html).
Normally I would do this using PHP's include() function.

Is the best way to do this in JavaScript to create a .js file and have the html in a string and use <script> to bring it in?

Thanks!

felgall
05-24-2012, 03:07 AM
Since not everyone has JavaScript there is no way to add content to the page using JavaScript that will work for everyone.

You can embed an entire separate web page into HTML using an object tag (which replaced the old iframe tag back in 1997) in the HTML itself. Any HTML you add from JavaScript will only be seen by some visitors.

MeltingDog
05-24-2012, 07:14 AM
Since not everyone has JavaScript there is no way to add content to the page using JavaScript that will work for everyone.

You can embed an entire separate web page into HTML using an object tag (which replaced the old iframe tag back in 1997) in the HTML itself. Any HTML you add from JavaScript will only be seen by some visitors.

Thanks Felgall,

Are you able to elaborate a little more?

VIPStephan
05-24-2012, 09:42 AM
Are you able to elaborate a little more?

http://joliclic.free.fr/html/object-tag/en/index.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum