Is it possible to read another url's dom structure?

javascript

Solution

If I am getting your question right,

A cross domain example by using yql,

var url = 'xyz.com'; // website you want to scrape
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + url + '"') + '&format=json&callback=?';  
$.getJSON(yql,function(data){
    if (data.results[0]){  
        console.log(data = data.results[0].replace(/<script[^>]*>[\s\S]*?<\/script>/gi, ''));  // The scraped data (the whole webpage)
    }
});

Reference: How can i get Equivalent method of HttpwebRequest in javascript

Problem

Obviously modifying it would be out of the question. But you would think just reading it should not be a problem? If i have my .js running on someone's system and I want to analyze the DOM of another URL , client side, is there a way to do this? Something simple like pull the title tag or pull the url...maybe load the site into an iframe to accomplish this?

Original source

Related problems