virtual_odin Posted May 19, 2007 Share Posted May 19, 2007 I want to create a frames page where one frame is a php script (triggered by a form button) which reads the content of the other frame. The script will look for certain patterns, eg images, links, etc. Any suggestions gratefully received. Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/ Share on other sites More sharing options...
neel_basu Posted May 19, 2007 Share Posted May 19, 2007 So whats teh problem ?? Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257023 Share on other sites More sharing options...
virtual_odin Posted May 19, 2007 Author Share Posted May 19, 2007 I want the frame I am extracting from to be the current frame having navigated there say from a search engine, so in the code I don't know what it is. I guess therefore what I am asking is how do I dig out the actual address of the second frame? Here's the idea (not working...) http://sandbox.club-host.com/pic.php Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257036 Share on other sites More sharing options...
Lumio Posted May 19, 2007 Share Posted May 19, 2007 You can do that with Javascript. Maybe that works: <input type="button" onclick="alert(window.document.getElementByName('mainFrame').location.href)" value="get url" /> Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257044 Share on other sites More sharing options...
virtual_odin Posted May 19, 2007 Author Share Posted May 19, 2007 Thanks Lumio. You are on to the right track, I think. I had not thought to use JavaScript. But I get an error window.document.getElementByName is not a function when I run your suggestion. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257146 Share on other sites More sharing options...
kathas Posted May 19, 2007 Share Posted May 19, 2007 the function Lumio might want to say is document.getElementById('') so window.document.getElementById('mainFrame') and add to the HTML tag id="mainframe" and then you can get the HTML content using window.document.getElementById('mainFrame').innerHTML Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257159 Share on other sites More sharing options...
Lumio Posted May 19, 2007 Share Posted May 19, 2007 But also getElementByName should work. Well! Try it I don't know so. Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257164 Share on other sites More sharing options...
virtual_odin Posted May 19, 2007 Author Share Posted May 19, 2007 Then I get the error window.document.getElementById("mainFrame") has no properties Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257205 Share on other sites More sharing options...
Lumio Posted May 19, 2007 Share Posted May 19, 2007 I didn't test it... but maybe this works: alert(parent.mainFrame.location.href); Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257207 Share on other sites More sharing options...
virtual_odin Posted May 19, 2007 Author Share Posted May 19, 2007 I'm really grateful but now the error is Error: uncaught exception: Permission denied to get property Location.href Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257209 Share on other sites More sharing options...
Lumio Posted May 19, 2007 Share Posted May 19, 2007 I found out, that you only can use that with sites of your server. If it's a different site, you don't have permission to it. Quote Link to comment https://forums.phpfreaks.com/topic/52121-reading-the-contents-of-a-frame-from-another/#findComment-257223 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.