...

View Full Version : Can you write a meta tag after a page is loaded?



Mdonahue37
05-16-2007, 03:45 PM
Goal - to generate a keyword meta tag based on text from a page.
Plan - to use a span tag with a class of keyword to wrap a word or phrase to be used in the keyword meta tag.

Planned Steps:
1. find all span tags
2. loop thru span tags to find the ones with a class of "keyword"
3. get the text between the open and closing keyword span tags
4. write a keyword meta tag to the head element with the text gathered.

Issue - Since the page needs to be loaded for the script to find the span tags, is it possible to write the meta tag after it's loaded? Would I need to reload the page to write it in? Or, is this better handled by PHP?

Thanks in advance for any help,
Mike

_Aerospace_Eng_
05-16-2007, 04:32 PM
What would be the point? Using javascript will make the meta tag useless to search engines. Doing it server side would be better but a little time consuming because you would need to get the contents of the page, search it, and add the meta tag before it gets to the user.

smalldog
05-16-2007, 04:36 PM
Generate a keywords meta tag using JS doesn't make a sense, because robots like Googlebot ignore JS. PHP (or server side scripting) is the only way.

Mdonahue37
05-16-2007, 04:48 PM
You're both absolutely right, I didn't think of that. Question answered.

They really need a smiley that conveys blonde moment.

Thanks guys.

felgall
05-16-2007, 09:02 PM
Most search engines completely ignore the keywords meta tag in any case.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum