Add title to the iframe(google map)

joyanta sen asked on November 26, 2018 18:57

Hi,

I need to add a title to the iframe created by Kentico basic google map web part. Could you please let me know how can I achieve that?

Thanks.

Recent Answers


Zach Perry answered on November 26, 2018 19:02

What do you mean Title? You trying to add HTML before the IFrame? If so, should be able to add it in the HTML Before of the webpart.

If you want to modify the content inside an IFrame,you can't most likely., but you would have to do it with javascript.

0 votesVote for this answer Mark as a Correct answer

joyanta sen answered on November 26, 2018 19:24

Hi, Thanks for your reply. By saying title,I mean to say,adding title attribute in the iframe tag.

Thanks.

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on November 26, 2018 19:33

That IFrame is created by the Google Maps API, so there is no way to set it outside of JavaScript.

You will have to do something like this:

google.maps.event.addListenerOnce(map, 'idle', () => {
  document.getElementsByTagName('iframe')[0].title = "Google Maps";
})

You can add this to the GoogleMaps.js file in the Maps/Basic/BasicGoogleMaps_files folder.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.