Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile Grab Meta Information

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    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.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,335
    Thanks
    11
    Thanked 588 Times in 569 Posts
    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.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • Users who have thanked rnd me for this post:

    eurojen (05-28-2009)

  • #4
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up Thanks

    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



    Jenny


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •