Iframe and Javascript

  • baligena
  • Novice
  • Novice
  • No Avatar
  • Joined: Apr 15, 2011
  • Posts: 25
  • Status: Offline

Post April 20th, 2011, 5:50 pm

Is there a way for me to access a link in a iframe using javascript
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 20th, 2011, 5:50 pm

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 15, 2011
  • Posts: 1195
  • Loc: Sydney
  • Status: Offline

Post April 21st, 2011, 10:24 am

why don't you just use iframe in HTML and show the page where the link is? or you can add a hyperlink.
  • baligena
  • Novice
  • Novice
  • No Avatar
  • Joined: Apr 15, 2011
  • Posts: 25
  • Status: Offline

Post April 22nd, 2011, 8:43 pm

Am I able to access what is in the iframe by using getElementsByTagName or its not possible considering it can be a security issue
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post April 22nd, 2011, 11:17 pm

You can do the following:

Code: [ Select ]
var mFrame = document.getElementById("frame_name");
var content = mFrame.contentWindow.document.body.innerHTML;
  1. var mFrame = document.getElementById("frame_name");
  2. var content = mFrame.contentWindow.document.body.innerHTML;
#define NULL (::rand() % 2)
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Joined: May 21, 2004
  • Posts: 3229
  • Loc: South Africa
  • Status: Offline

Post April 24th, 2011, 9:26 am

Ditch the iframe
Watch me grow
  • baligena
  • Novice
  • Novice
  • No Avatar
  • Joined: Apr 15, 2011
  • Posts: 25
  • Status: Offline

Post April 25th, 2011, 6:35 pm

FYI

SpooF your code is not comparable with IE. Just switch 'contentWindow' with 'contentDocument' if anyone ever needs too.

Thankx

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 108 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.