scuff Posted December 6, 2009 Share Posted December 6, 2009 Is it possible to do something like this: page 1: <img src="page2.php"> page2.php: <?php header("Location: http://www.example.com/"); ?> Basically I want to know if page1 can redirect to a page specified by page 2 using img src. Is that possible? Quote Link to comment Share on other sites More sharing options...
Brandon_R Posted December 6, 2009 Share Posted December 6, 2009 You cannot use the header function if output has already started or sent. If you visit page2.php directly it will redirect to example.com however embedding it in an HTML page will not work. You may want to try <meta http-equiv="refresh" content="0;url=http://example.com/"> Quote Link to comment Share on other sites More sharing options...
scuff Posted December 6, 2009 Author Share Posted December 6, 2009 I tried putting <meta http-equiv="refresh" content="0;url=http://example"> on page2.php but it didn't work, so basically you can't redirect from img src, right? Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 6, 2009 Share Posted December 6, 2009 I tried putting <meta http-equiv="refresh" content="0;url=http://example"> on page2.php but it didn't work, so basically you can't redirect from img src, right? Why are you even doing this? The image tag is for an image, if you didn't know, and the browser will only render it as so. If that would allow redirecting the bloody web would be 1000x as spammy than before. Page2.php can redirect to http://www.example.com/image.jpg. Quote Link to comment Share on other sites More sharing options...
scuff Posted December 6, 2009 Author Share Posted December 6, 2009 lol good just making sure for security reasons on my site I'm trying to disable every possible way of redirecting Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 6, 2009 Share Posted December 6, 2009 lol good just making sure for security reasons on my site I'm trying to disable every possible way of redirecting Only thing you'd need to watch out for is XSS, which relates to problems with javascript. The IMG tag will just output a resulting image if it is supported, such as mimetype image/jpg(gif/png/xmp/) Quote Link to comment 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.