View Full Version : Onkeyup on an iframe?
Hi all,
I'm looking to assign an onkeyup event to an iframe, but as 'onkeyup' isn't supported on iframe tags now i'm having a bit of trouble doing this.
It doesn't have to be exactly an onkeyup event I suppose, just something that runs a javascript function when the user presses a key inside the iframe.
Thanks :)
Gargoyle
2008-09-30, 09:43
Not sure you are going to get away with that unless the contents of the iframe are from the same source as the main page content. JavaScript has a "same origin" security model which stops you running AJAX do a different server than the one the script came from - I think the same will apply to iframes, otherwise it could be a very easy way to mess with someone elses content.
Hi, thanks for the reply.
I forgot to mention its for a rich text editor, so it won't be displaying any external content.
Do you think this will be possible?
The code is literally just <iframe id="content"></iframe>,with the designMode enabled.
Could always check for onkeyup in the iframe and then do something like
window.top.window.someFunctionOnTheParentPage(lol params wtf?!)
Don't ask me to explain, but sure did work for me when I used an iframe for my 'ajax' image uploading component.
vBulletin® v3.6.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.