1

I am having two html files. One file should include the source of other file like this.

file1.html

<html>
    <head></head>
    <body>
      <span>Hello #{bean.name}</span>
    </ >
</html>

file2.html

<html>
    <head></head>
    <body>
        <iframe src="file1.html"></iframe>
    </body>
</html>

Inside iframe i want to display a string "Hello John" depending upon the user. How to pass the parameter name to file1.html

Achaius
  • 5,904
  • 21
  • 65
  • 122

1 Answers1

2
<html>
    <head></head>
    <body>
        <iframe src="file1.html?user=John"></iframe>
    </body>
</html>

Then, in file1, you could your server-side language of choice (e.g. PHP) to safely take that value from the query string and put it on the page. Alternatively, you could use JavaScript to take the value from the query string.

Either way, make sure the value is properly escaped(!!!) to avoid XSS attacks.

Community
  • 1
  • 1
ClosureCowboy
  • 20,825
  • 13
  • 57
  • 71