-1


i load my iframe src from address bar like:
http://site.com/demo.php?go=http://google.com

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<iframe src="<?php echo $_GET["go"];?>">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>


now i want to get iframe title and echo it in demo.php title tag…
is it possible?

MaveRick
  • 1,181
  • 6
  • 20
BIGsmall
  • 13
  • 4

3 Answers3

2

Use JavaScript instead. Like this:

var iframeTitle = document.getElementById("myIframe").documentElement.title

lsouza
  • 2,448
  • 4
  • 26
  • 39
0

You can parse and retrieve the go URI with these kind of functions

function getURLParameter(name) {
    return decodeURI(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
    );
}

and then source the iframe calling getURLParameter('go') Btw, as you wish, to put it in a title tag, you have to add this $('title').val(getURLParameter('go')) (using jQuery) or in pure javascript document.element.getElementsByTagName('title').value = getURLParameter('go')

You should read some javascript doc !

epsilones
  • 11,279
  • 21
  • 61
  • 85
0

You need to control and sanitize your variable 'go'.

devseo
  • 1,182
  • 1
  • 13
  • 26