/    Sign up×
Community /Pin to ProfileBookmark

New Window interaction

So what i want to do is open a new window. I want to use target.

so i open a new window with target “test_win”

now i want to use js to get the html content of “test_win” is this possible?

i tried with non target method:

[code]
<script type=”text/javascript”>
var abc =””;
function open_win()
{
abc = window.open(“http://www.google.com/”,”subWindow”,”HEIGHT=200,WIDTH=350″)
}

function gethtml() {
alert(abc.document.getElementById(“content”).innerHTML);
}
</script>
[/code]

the above gethtml() functions gives me an error “permission denied” >_<

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Angry_Black_ManAug 03.2008 — youre not allowed to access the DOM of a webpage that isnt on your domain.
Copy linkTweet thisAlerts:
@pg300authorAug 03.2008 — is there no way to get the source? ?
Copy linkTweet thisAlerts:
@Angry_Black_ManAug 04.2008 — you can use PHP (or other server side code) to retrieve a webpage's HTML . then, using AJAX preferrably, you can make it accessible to javascript.
×

Success!

Help @pg300 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...