antonyfal Posted April 30, 2012 Share Posted April 30, 2012 Hi, is it possible and how to do it. I have a onclick="reference to a function" on my parent page. The script for the function on a page located in an iframe. I have control over the domain path.. The onclick looks like this: <a href="javascript:void(0);" onlick="javascript:chatto('50' ,'john doe');"></a> the page can have several links located arround the page with different user names and id's.. the script is located on an iframe page: <iframe src="chat.php"></iframe> the chat.php includes the chat.js file. is this possible and how can i achieve this? Quote Link to comment https://forums.phpfreaks.com/topic/261862-same-domain-pass-onclick-event-to-iframe-page-containing-the-script/ Share on other sites More sharing options...
.josh Posted May 1, 2012 Share Posted May 1, 2012 if it is indeed on the same domain, you can reference it with the parent object: window.parent.someFunction. If the parent window and iframe window do not share the same domain, then it is not possible, as this is cross-site-scripting. Quote Link to comment https://forums.phpfreaks.com/topic/261862-same-domain-pass-onclick-event-to-iframe-page-containing-the-script/#findComment-1341844 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.