I don't have access to the HTML of a website I've been asked to work on but I can insert Javascript via a custom Javascript input box on the site builder tool.
<meta property="og:url" content="https://www.whyottawa.ca/speakers/jeff-jeffrey/">
I need to set an element to "display:none" if the line above from the <head>
element includes the content, "https://www.whyottawa.ca/speakers/*" using * as a wildcard.
I've tried something like
if (document.head.og:url.content === "https://www.whyottawa.ca/speakers/*") {
document.getElementById('hide').style.display = "none";
};
but it doesn't like the ":" in the og:url property. Is there a way to escape this? Or a better syntax?
I also tried an attribute selector such as meta[content|="https://www.whyottawa.ca/speakers/"]
but I got the error, 'ReferenceError: meta is not defined'