Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Manipulate meta keyword tag using php and javascript

Change keyword content in parent window after iframe loads



10:58 pm on Aug 31, 2010 (gmt 0)

5+ Year Member


I wrote a few php classes that generate keywords from a string. This string is loaded from a database onto a lightbox iframe which can be selectively opened and closed by a user. All of the keywords are consolidated into one php variable. Because of the way php is structured, I can only manipulate the meta keywords of the page loading within the iframe and not that of the parent window. Unfortunately, my JavaScript abilities are lacking to say the least; would anyone be kind enough to show me how to manipulate the parent window meta keywords using the keyword list I derive from within an iframe? Or at least point me in the direction of a beginners tutorial for such a task? Thank you.



10:15 pm on Sep 2, 2010 (gmt 0)

10+ Year Member

What is the point of manipulating the meta tags using javascript if it only happens on the client side, thus absolutely not useful to the crawlers?

If you still want to do it -- you can only manipulate the parent of the iframe if it is on the same domain (due to the crossdomain security restrictions).

If it IS the same domain, then you can start from an example like this:
parent.document.getElementsByTagName("meta")[0].innerHTML = "my keyword"
-- didn't try this, but the 'parent' part is what you need.


9:21 pm on Sep 3, 2010 (gmt 0)

5+ Year Member

You make a good point Alias. It may be that my only option is redesigning these pages to allow separate crawler indexing. Thank you for the example.


Featured Threads

Hot Threads This Week

Hot Threads This Month