How to access the content of a webpage?

I was trying to get the contents from a dynamic webpage. In Javascript, I was able to access the Window object and access all the elements of the current webpage. Likewise, how can I access any other webpage and access its content?

My idea is to create a frame in my webpage and load the page(which I wanted to access), into that frame. Then I will have control over the elements of my target webpage and so can access the contents.