web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

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

(0) ShareShare
ReportReport
Posted on by 6

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.

I have the same question (0)
  • Suggested answer
    Petr Jantac Profile Picture
    Moderator on at

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans