Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy Jvascript - injection: create iframe on the page

    okay ive been looking at javascript injection and at one point had an iframe injected into a page on a site (non permanent) then i fell asleep and forgot how i did it >.< in my attempt to redo this i have come up with this bit of code...
    Code:
    javascript:var iframe=document.createElement('iframe'); iframe.setAttribute("src","http://www.google.com");iframe.setAttribute("width","500px");iframe.setAttribute("height","500px");document.body.appendChild(iframe);
    yes it is all in a line and yes it is supposed to be lol. When i inject this particular 'line' of javascript i dont get anything but a new page that merely says
    [object HTMLIFrameElement]
    ther rest of the page is blank. Any ideas on how to get the iframe to actually appear on the page so i can see it and use it?

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by jhouns View Post
    Any ideas on how to get the iframe to actually appear on the page so i can see it and use it?
    'px' is a CSS specifier and the appendChild needs to be called using void():
    Code:
    javascript:iframe=document.createElement("iframe");iframe.setAttribute("src","http://www.google.com");iframe.setAttribute("width","500");iframe.setAttribute("height","500");void(document.body.appendChild(iframe));

  • Users who have thanked Arty Effem for this post:

    jhouns (09-01-2008)

  • #3
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    ah thanks it worked pefectly =D i was looking at it for like a day brilliant appropriate thanks will be given.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •