Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

How to change the language of a marketing form hosted as iframe

Posted on by 29

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.

  • Suggested answer
    Petr Jantac Profile Picture
    Petr Jantac on at
    RE: How to change the language of a marketing form hosted as iframe

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans