bragboy
bragboy

Reputation: 35542

How to dynamically get the DOM of a web page in Javascript

I would want to dynamically get the DOM structure (HTML source) of a web page. I want to do some manipulations with it later. Is this possible in javascript at all?

Thanks.

Upvotes: 2

Views: 5195

Answers (3)

tster
tster

Reputation: 18237

Your best (and safest) bet is to either fetch the other web page server side and include it in the HTML of your page as a hidden element.

Upvotes: 1

Francisco Soto
Francisco Soto

Reputation: 10392

Yes, it is. It is a core part of browser's Javascript, DOM manipulation of your web page.

http://www.quirksmode.org/dom/intro.html

https://developer.mozilla.org/en/The_DOM_and_JavaScript

Upvotes: 1

Quinn Wilson
Quinn Wilson

Reputation: 8261

This is possible - it's what javascript is for! Use the document object. i.e.

document.documentElement.innerHTML

Upvotes: 1

Related Questions