-1

Scenario: user clicks on a click from an email campaign. This link appends parameters to the end of the URL. I would need to get the params and send them to the contents (url) of an iframe* embedded on the page.

If possible, how?

  • There's a potential for x-domain issues here. Currently (while on dev environment) the iframe points to another domain, though both the page and iframe will eventually live on the same domain.
Sal B
  • 540
  • 1
  • 5
  • 20

2 Answers2

0

You could do this by passing them through as GET data to the src of the iframe. if the parent page is php then you could access the data server side and include it in the src for the iframe before you serve the page to the client.

echo("<iframe src='http:yourURL.com?data=" . $_GET['VariableName'] . "'></iframe>");
Oli Folkerd
  • 7,510
  • 1
  • 22
  • 46
  • It's a static HTML page the iframes a form. Perhaps I can append those variables via jQuery into the iframe attr 'src'? – Sal B May 02 '14 at 23:32
0

This ended up working for me:

var loc = window.location.toString(),  
        params = loc.split('?')[1],  
        iframe = document.getElementById("signupIndex");

    iframe.src = iframe.src + '?' + params;
Sal B
  • 540
  • 1
  • 5
  • 20