Templates Plugins Courses

Checking the presence of a special meta tag in HTML code

Hey. Let me know if this feature can be implemented in Bubble: When hosted on my service, site owners must add a special meta tag to the site’s home page HTML (in the header section) to verify ownership of the site. After the site owner has placed the tag, he clicks the check button and checks for that meta tag in the site header. Is there a plugin that can check this, or is there another solution to this problem?

Hi @vdghtqnbyu,

Thanks for reaching out. I’m afraid it would not be possible without using some custom JS script in this case. We cannot provide exact solutions on this matter, but perhaps pointing into the right direction.

You can use the following snippet to call this function on a button click:

function getMeta(metaName) {
  const metas = document.getElementsByTagName('meta');
  for (let i = 0; i < metas.length; i++) {
    if (metas[i].getAttribute('name') === metaName) {
      return metas[i].getAttribute('content');
    }
  }
  return '';
}
console.log(getMeta('video'));

The result to be passed to a javascript for bubble variable, and then use it or tweak it as you desire. The meta tag should be of the following format:

<meta property="YOUR_META_TAG_NAME" content="YOUR_CONTENT" />

You can also find more help here https://forum.bubble.io/ for more Bubble-based implementations.

Hope it helps.

Best,
Alex

Thanks. I’ll try to do it.

1 Like