Javascript inside LD JSON -


i'm wondering if it's possible execute javascript inside ld+json script. example "window.location.hostname"

<script type="application/ld+json"> {    "@context": "http://schema.org",    "@type": "website",    "url": "http://" + window.location.hostname } </script> 

no, scripts of type "application/ld+json" won't executed. but, this:

<script>   var el = document.createelement('script');   el.type = 'application/ld+json';   el.text = json.stringify({     "@context": "http://schema.org",     "@type": "website",     "url": "http://" + window.location.hostname   });   document.queryselector('body').appendchild(el); </script> 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -