Forum Moderators: open

Message Too Old, No Replies

How Do I Put Content Within Javascript Code?

         

wildguy

8:36 pm on Jan 22, 2006 (gmt 0)

10+ Year Member



I must be the only one who doesn't know how to do this, but...

I'd like to put a paragraph on one of my pages that the search engines won't see. I'd like to do it with Javascript. Is there a way to simply wrap the paragraph with a couple lines of javascript code?

I don't want to have an external .js if I can avoid it.

Do I need to put something like this at the top of my page?

<script src="Externaljs.js" language="javascript" type="text/javascript"></script>

Again, sorry if this is a silly question. But, I'm a dunce when it comes to code.

Thanks for any help.

Rambo Tribble

9:26 pm on Jan 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
</style>
<script type="text/javascript">
window.onload=function(){
document.getElementById('d2').innerHTML="Un-crawled content."
}
</script>
</head>
<body>
<div>
Content of choice.
</div>
<div id="d2">
</div>
<div>
More content.
</div>
</body>
</html>

DrDoc

10:47 pm on Jan 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



... except, it won't be uncrawled content. :)
The spiders crawl JavaScript as well.

Rambo Tribble

12:20 am on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, darn those little critters. Perhaps an external script? Or maybe HTML entities? Place the text in an array and assemble it at run? Encryption? Write in Klingon (though, as a Tribble, I find that objectionable)?

Perhaps simpler than all of this would be to place the text in a separate document and load it an iframe. The separate document could have a robots meta tag to exclude crawlers. [robotstxt.org...]

And yet simpler still, is to create an image of the text and incorporate in the document with an img tag.