This question already exists in the SO in English, but to facilitate your understanding I will give a translated
On the page where the iframe will appear:
function myFunction(){
$('#meuIframe').attr('src', "meuIframe.html?param1=value1¶m2=value2");
}
Inside your iframe:
function getParamValue(paramName) {
var url = window.location.search.substring(1); // Pega as variaveis na url
var qArray = url.split('&'); // pega os pares de chave e valores
for (var i = 0; i < qArray.length; i++) {
var pArr = qArray[i].split('='); // Separa a Chave do Valor
if (pArr[0] == paramName)
return pArr[1]; // Retorna o Valor
}
}
If you want to get a specific parameter use:
var param1 = getParamValue('param1');
Original post link
Credits: Ozgur Bar