...

View Full Version : Grab Meta Information



eurojen
05-27-2009, 07:16 PM
Hi
I'm trying to create a script that will grab Meta content from a remote website. I have similar code that runs in PHP but would like to avoid the post.
To be more specific, I would like to grab the meta title and description for automatic insertion into a directory.
Is this possible in Javasript??

My javascript is somewhat basic but if someone could point me in the right direction, I would be gratefull.

Regards

Eurojen

Philip M
05-27-2009, 08:33 PM
JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), communicate with the server, access a database or the client's operating system, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.

rnd me
05-28-2009, 01:25 AM
you can do it in a roundabout way, but not directly.

google provides the "ajax search api", which can be used from/by JavaScript.

searching for a url should place that url as the top result on google.

google provides info harvested from meta tags in the search results provided by the API.

thus, if you can live with google, you should be able to grab the info you need, or something close.

eurojen
05-28-2009, 03:26 PM
Thanks you both for your replies. I had a feeling that the client-side aspect of javascript would be a problem.

I will look into the Google API


Regards
:thumbsup:


Jenny



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum