/    Sign up×
Community /Pin to ProfileBookmark

DOM of another window or URL

Question: Why is the result of this:

var main2 = ‘ ‘;
main2 = window.open(“http://www.google.com”, “main2”);



I would think it should be:


Furthermore, is there any simple way to grab the DOM by supplying a URL? I’m looking to turn the web into my database (with support for cookies) with Javascript or PHP but not with Perl, as described in this <a href=http://www.developer.com/lang/article.php/3495126>article</a>.


to post a comment

3 Comments(s)

Copy linkTweet thisAlerts:
@KorNov 02.2005 — you have gave the same name to the variable and to the name of the window (which are different things)

var main2 = window.open("http://www.google.com", "[COLOR=Red]doesntmatter[/COLOR]");

Copy linkTweet thisAlerts:
@robinhoodeauthorNov 02.2005 — Ok.. yet this:

var whatever = window.open("http://www.google.com");


or this:

var whatever = window.open("http://www.google.com");


still returns:


I'm trying to extract info on a given web page (one which has cookies), from the web browser. This is just a start in that direction.
Copy linkTweet thisAlerts:
@KorNov 02.2005 — well, yes. If the two pages are from different domains, you can not reach them via javascript. But you can use AJAX to grab information from another page, if different domain.



Help @robinhoode spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 9.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: @ddiebold17,
tipped: article
amount: 1000 SATS,

tipper: @Mqlinka19,
tipped: live stream
amount: 4900 SATS,

tipper: @Mqlinka19,
tipped: article
amount: 10 SATS,