Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-31-2008, 10:52 PM   PM User | #1
jhouns
New Coder

 
Join Date: Aug 2008
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
jhouns is an unknown quantity at this point
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
Quote:
[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?
jhouns is offline   Reply With Quote
Old 09-01-2008, 02:07 AM   PM User | #2
Arty Effem
Banned

 
Join Date: May 2006
Location: England
Posts: 664
Thanks: 0
Thanked 84 Times in 84 Posts
Arty Effem can only hope to improve
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));
Arty Effem is offline   Reply With Quote
Users who have thanked Arty Effem for this post:
jhouns (09-01-2008)
Old 09-01-2008, 12:15 PM   PM User | #3
jhouns
New Coder

 
Join Date: Aug 2008
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
jhouns is an unknown quantity at this point
ah thanks it worked pefectly =D i was looking at it for like a day brilliant appropriate thanks will be given.
jhouns is offline   Reply With Quote
Reply

Bookmarks

Tags
htmliframeelement], iframe, injection, javascript, [object

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:02 PM.


Advertisement
Log in to turn off these ads.