homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Manipulate meta keyword tag using php and javascript
Change keyword content in parent window after iframe loads

5+ Year Member

Msg#: 4194787 posted 10:58 pm on Aug 31, 2010 (gmt 0)


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+ Year Member

Msg#: 4194787 posted 10:15 pm on Sep 2, 2010 (gmt 0)

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.

5+ Year Member

Msg#: 4194787 posted 9:21 pm on Sep 3, 2010 (gmt 0)

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.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved