I have a website on which I transmit information to the analytics engine through the meta tag as such:
<meta property="analytics-track" content="Hey There!">
I am trying to write a JavaScript script (without libraries) to access the content section and get the information as is. Essentially, it should include an HTML object, not transform it.
The reason is because I use PhantomJS to check which pages have HTML objects in the metadata and delete them, because they messed up my analytic data (for example, I will have records containing both Hey There!, and Hey There!when in fact they are one and same page and therefore should not have two separate data points).
The simplest JS format I have is:
document.getElementsByTagName('meta')[4].getAttribute("content")
And when I examined it on the console, it returns the text in the following format:
"Hey There!"
I would like him to return:
"Hey There!"
How can I guarantee that the returned data will contain an HTML object. If this is not possible, there is a way to detect the HTML object through JavaScript. I tried:
document.getElementsByTagName('meta')[4].getAttribute("content").includes(' ')
But it returns false
source
share