Hi,
I have created a Marketing form hosted that into webpage as an Iframe and I want to change the language of form by using query parameter in url . For that I have added below Javascript/Jquery code to the HTML of Marketing form but JS code is not working nor I am able to debug the code as it is inside the Iframe.Below is my code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function getParameterByName(name, url) {
debugger;
if (!url) url =window.parent.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var dynamicContent = getParameterByName('lang');
$(document).ready(function () {
debugger;
// $('#lang').val('eng');
// $('#lang').on('change', function() {
console.log('click');
if (dynamicContent == "en") {
debugger;
$(".cls_email").html("E-mail");
$(".cls_company").html("Company");
$(".cls_name").html("Name");
$(".cls_surname").html("Last Name");
$(".cls_submit").html("Submit");
}
});
Can Anyone Suggest any way to change the language of the form?
Thanks.
Hi,
I think you may have a problem accessing the URL of the parent page from iframe. If the parent page and iframe are not on the same domain/subdomain it can be considered as cross site scripting and blocked by the browser.
Petr
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156