meta-tags

Get meta data attribute in javascript

假如想象 提交于 2019-12-03 13:40:44
问题 I am having trouble retrieving information from a meta tag. I am trying to get an img src from a website and can't quite figure it out. Here is an example of what I am trying to do. <meta property="og:image" content="http://foo.jpg"> var image = document.querySelector('meta[property="og:image"]').getAttribute('content'); I have tried this but it doesn't work. Any ideas? 回答1: meta elements aren't special, you can query for them and get their attributes in the normal way. In this case, here's

Are HTML Meta Tags still important? [closed]

半腔热情 提交于 2019-12-03 13:34:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . I read some articles on Internet, some said that search engine like Google and Bing don't care about HTML Meta Tags any more. Should I still need to maintain the HTML Meta Tags in my website properly? Thanks! 回答1: Are meta tags critical? Every search engines emphasizes meta tags differently. Google doesn't let

“apple-mobile-web-app-title” on Android

流过昼夜 提交于 2019-12-03 11:37:39
is there an equivalent to iOS 6 meta tag apple-mobile-web-app-title for android web-applications? Something that gives you the possibility to define a long title and a short title. <title>Long name</title> <meta name="apple-mobile-web-app-title" content="Short name"> This is possible using the "application-name" meta tag. However it only appears to work with chrome. Firefox and the android browser don't use the title tag <head> ... <meta name="application-name" content="Awesome App!"> ... </head> From, Usage in web applications section http://w3c-webmob.github.io/installable-webapps/ Chrome

iOS / mobile safari still zooms while viewport is set to user-scalable=no ? Check Accessibility settings!

拟墨画扇 提交于 2019-12-03 11:36:16
问题 This specific Mobile Safari (seemingly impossible and yet undocumented) problem kept me going for a long long time today, and I was just about to post a question about it here when I figured it out. The problem: While I had set <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no;"/> my iPad web-app still allowed manual zooming (pinching in the browser). -- But only on my iPad, not on my iPhone. Also I would rotate the

Precedence of X-Robots-Tag header vs robots meta tag

被刻印的时光 ゝ 提交于 2019-12-03 11:30:39
I've placed the following Header in my vhost config: Header set X-Robots-Tag "noindex, nofollow" The goal here is to just disable search engines from indexing my testing environment. The site is Wordpress and there is a plugin installed to manage per-page the meta robots settings. For example: <meta name="robots" content="index, follow" /> So my question is, which directive will take precedence over the other since both are being set on every page? d-stroyer I am not sure if a definitive answer can be given to the question, as the behavior may be implementation-dependent (on the robot side).

Meta tags itemprop

与世无争的帅哥 提交于 2019-12-03 10:58:26
问题 I am trying to include extracted structured data in my webpages. I included this for description: <meta itemprop="description" content="my description" /> However I realised that there is already a normal meta description on the page: <meta name="description" content="my description" /> Is it ok to leave both of them or it is really necessary to merge them together maybe like: <meta itemprop="description" name="description" content="" /> 回答1: You should leave both of them. The Microdata Spec

How to handle meta elements not validating in HTML5?

妖精的绣舞 提交于 2019-12-03 08:52:57
In HTML5, some meta elements do not validate (yet?) like: <meta http-equiv="x-ua-compatible" content="ie=emulateie7;chrome=1"> <meta http-equiv="imagetoolbar" content="no"> Are Conditional Comments an appropriate solution here resp. will meta elements still work as expected? <!--[if IE]><meta http-equiv="x-ua-compatible" content="ie=emulateie7;chrome=1"><![endif]--> <!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no"><![endif]--> Using a .htaccess file instead of meta elements (not always possible unfortunately), would this be the right way to go? <IfModule mod_setenvif.c> <IfModule

Is it a good practice to store the csrf token in meta tag?

拈花ヽ惹草 提交于 2019-12-03 06:25:23
If I make a POST request without using form and want to prevent CSRF attack, what I can do is to set the csrf-token in meta tag and put it back to the header when the request is triggered. Is it a good practice? <meta name="csrf-token" content="xxx"> Put the token back via the header, using JQuery for example: $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); Yes this is good practice. If you are using ajax I think this is the cleanest solution. You could also put the token inside of the form (which is more convenient if submitting the whole form), but

How to change meta tags in zend framework layout

佐手、 提交于 2019-12-03 06:18:56
问题 So I have some default meta tags on layout.phtml set using $this->headTitle() and $this->headMeta()->appendName() and is echoed at layout.phtml's header My question is: How do I change those default meta tags from the view file such that they are replaced? I tried using: $this->headMeta()->appendName() or setName() Instead of replacing the old default meta tags, it would create an entirely new meta tag. How can I replace them? 回答1: I would recommend setting a view variable for the keywords.

imagetoolbar meta tag and IE versions

三世轮回 提交于 2019-12-03 05:55:05
问题 There are quite a few questions here on SO about the following meta tag not being HTML5 compliant and therefore will not validate when using <!DOCTYPE html> : <meta http-equiv="imagetoolbar" content="no"> I also know this tag is specifically for one purpose alone: hiding the toolbar that appears when you hover your mouse over any image in Internet Explorer. However, I could not find out in exactly which versions of Explorer this is applicable. When I Googled it, most results only mention IE6,