SSI alternative

A

Ali Babba

hi all,

my ISP doesnt support SSI and therefor i try to javascript to get the
same think done. the function i am interested in is ssi include virtual
and after some searching i found many times the same anser; use:

<!--
document.write(" your HTML here ");
// -->

now the problem is that it only works when all HTML is put in 1 line !
and this line cannot be longer than about 255 characters.

i am working on a winXP machine and have tried to use a unix-like-editor
(breakline thing) but still the same thing.

question: do i do something wrong or how to get it working ??

many thanks for helpful replies,

martin
 
M

McKirahan

Ali Babba said:
hi all,

my ISP doesnt support SSI and therefor i try to javascript to get the
same think done. the function i am interested in is ssi include virtual
and after some searching i found many times the same anser; use:

<!--
document.write(" your HTML here ");
// -->

now the problem is that it only works when all HTML is put in 1 line !
and this line cannot be longer than about 255 characters.

i am working on a winXP machine and have tried to use a unix-like-editor
(breakline thing) but still the same thing.

question: do i do something wrong or how to get it working ??

many thanks for helpful replies,

martin

First omit "<!--" and "-->" as they're obsolete then change

document.write(" your HTML here ");

to:

document.write(" your");
document.write("<br>HTML");
document.write("<br>here ");

or:

var html = [
"your",
"HTML",
"here"];
document.write(html.join("<br>"));
 
D

David Dorward

Ali said:
my ISP doesnt support SSI and therefor i try to javascript to get the
same think done.

Stop! Backpedel!

Including content using JavaScript is usually not a good idea. It will be
invisible for the not-insignificant proportion of the world which does not
have JS available and enabled (including GoogleBot).

You can achieve the effects of SSIs using an HTML preprocessor as described
at http://www.allmyfaqs.com/faq.pl?Include_one_file_in_another
 
A

Ali Babba

McKirahan said:
hi all,

my ISP doesnt support SSI and therefor i try to javascript to get the
same think done. the function i am interested in is ssi include virtual
and after some searching i found many times the same anser; use:

<!--
document.write(" your HTML here ");
// -->

now the problem is that it only works when all HTML is put in 1 line !
and this line cannot be longer than about 255 characters.

i am working on a winXP machine and have tried to use a unix-like-editor
(breakline thing) but still the same thing.

question: do i do something wrong or how to get it working ??

many thanks for helpful replies,

martin


First omit "<!--" and "-->" as they're obsolete then change

document.write(" your HTML here ");

to:

document.write(" your");
document.write("<br>HTML");
document.write("<br>here ");

or:

var html = [
"your",
"HTML",
"here"];
document.write(html.join("<br>"));

thanks alot !! of course it works.
also thanks to david, although i stick with this solution.
 
J

Jim Ley

now the problem is that it only works when all HTML is put in 1 line !
and this line cannot be longer than about 255 characters.

I've never known any browsers with a 255 character limit, could you
provide more details of where you worked out the limit?

Jim.
 
A

Ali Babba

Jim said:
I've never known any browsers with a 255 character limit, could you
provide more details of where you worked out the limit?

Jim.

255 was a guess, and not a good one.

i was using windows notepad, and it has apparently somewhere a limit on
the number of characters in 1 line.

just checked with a better editor and i didnt get any weird behaviour
until i arrived around 40k charcters in 1 line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top