Questions tagged [html-head]

1

votes
3

answer
84

Views

How to ask browser to cache files for future use

I have an app that is using some large libraries. There are almost 200 js and css files being loaded. And this is how it goes. First it loads 30 of them listed on first html. Than after running some. they trigger loading their own required files. After that library starts, I run a callback that star...
rturkek
1

votes
2

answer
31

Views

How do I load a selectable javascript in html header

I'm looking for a way to select and load a javascript from the html file arguments. The html file is called as follows: OSM_Map.html?year=2017 or OSM_Map.html?year=2018 In the OSM_Map.html file there is the following code in the header: ..... .... There is no problem to get the year argument from th...
Rob Udo
1

votes
2

answer
283

Views

download limit of getting headers in php

Does php native function get_headers() downloads all the content, or stops downloading after getting header?
nerkn
1

votes
1

answer
406

Views

Does head>link[href]'s protocol matter for SSL?

I recently started loading stylesheets on my webpages using just // instead of fighting between http:// and https://. E.g.: Now I wonder if the same should be done for the link[rel='canonical'] tags. E.g.:
Geo
1

votes
1

answer
1.1k

Views

Schema.org vs. OG meta in head

Is there a difference between doing the OG metadata in the head of your HTML for say Facebook and Google? If you add Schema.org markup to the body of your HTML document is it redundant to have OG data in the head? Is there an advantage to one over the other? Schema.org markup does not explicitly us...
Travis Glodt
1

votes
1

answer
79

Views

How to Display Today's Date in PHP Header

Total beginner php question: I want to put today's date in the header or my website. In my header.php file I have the following code:
whs2k
1

votes
1

answer
455

Views

Can the order in which adding link and meta tags on head of a webpage have any adverse effect?

I have added this code to my webpage with .php extension Now, cssheadertop.php contains the following code 8mags - CSS Lessons The cssheaderbottom.php file has following code page specific style here. I want to add meta description and meta keywords tag between and just like the link tag I have ad...
Nitish Kumar
5

votes
1

answer
32

Views

Order of picked up meta tags in the html-head

I was wondering if someone could explain how social media rich previews define which og:title to pick. I use wordpress and for certain pages I insert php echo strings to inject them into the . I choose to do that to change certain titles and descriptions into more commercial texts. What obvisouly ha...
Demian
1

votes
2

answer
891

Views

One or multiple meta-tags?

I just realized I have two meta tags in my HTML head: Do both work when there are multiple? Should I merge them? Is it just as good with having multiple meta-tags?
radbyx
1

votes
3

answer
162

Views

Should The Meta Tag Go In A Style Tag

Does the meta tag need to be enclosed in a style tag (like CSS): Or is this good:
Dani Springer
7

votes
4

answer
8.7k

Views

Why use <link rel=“apple-touch-icon image_src” …>?

While I was looking at the HTML source for my favorite website, I noticed that it's using Obviously the second link has something to do with Apple's iOS, but why isn't sufficient? What is special about iOS that it requires a dedicated shortcut icon?
Mike Pennington
3

votes
5

answer
940

Views

HTML / PHP: Which parts of an HTML head can be saved in a separate file

I am new to HTML and hope someone can help me with this. I am trying to set up a website where the code for every page is saved as a separate php file. Since all these pages use the same document head and includes I would like to remove as much as possible of this from the pages and save it in a s...
keewee279
2

votes
1

answer
585

Views

Get Absolute URL From File Absolute PATH in PHP

I have a function that checks existence of CSS/JS... file and then it returns whole or tag etc. Before it returns, it checks existence of that file file_exists() by absolute path. After that I'd like to get absolute URL of this file, to load even if request is like domain.com/abc/def. Is there any...
user1980807
20

votes
7

answer
15.4k

Views

Should Google Analytics go in the head or bottom of an HTML page?

Google advises putting the google analytics script right before closing the . However, I would prefer to combine it with the rest my javascript that are now all together in a cached, external file, which is loaded at the bottom of my HTML file. Can I do it my way? If so, what am I risking then/what'...
Sam
2

votes
4

answer
138

Views

Is there a valid reason about putting JS in the head of document?

I mean : I know the JS is cached only if it come from a .js file. Also, 90% of my functions must be rendered when the page (html) is loaded (rendered), so it is better put JS before closing the body tag. (this prevent also to use document .ready(); and the loading of the page itself will be more fas...
markzzz
2

votes
1

answer
678

Views

How to retrieve the head of a html document using YQL?

I'm curious if this is possible at all since a 'select * from html' query only returns the body of the document.
Franck
3

votes
2

answer
375

Views

Remove dynamically added css from <head>

On button click, I'm adding a css to the : $('head').append(''); which adds to : On another button click I need to remove it again. I tried the following, which doesn't work for some reason: $('html').on('click', '.clear-color-picker', function(events){ var id = $(this).attr('data-parentID').replace...
user1049961
6

votes
5

answer
4.5k

Views

Will style css tag render in body?

I am using a CMS and apparently it has a bug that will not allow me to add any content to the of a blog post. It inserts everything into the body which in most cases that works okay but in an instance of code like this: .slideshow img { display: none } .slideshow img.first { display: block } Will...
L84
5

votes
3

answer
785

Views

effective difference between html head for css tags?: @import url vs. link href

Is there a effective difference between @import url(/css/layout.css) all; and Do browser behave different ? What is recommended from w3c etc. ?
groovehunter
2

votes
1

answer
918

Views

Vertically center logo and title in HTML 5

I am trying to create a responsive version of my portfolio website and I am nesting my logo image and title inside the header tag. The older version used divs to float the logo and title on the left and right sides of the header. Here is where I got stuck at when I tried to space the img and h1 with...
user3424278
4

votes
1

answer
887

Views

Why there's 'This is not a zero-length file' in <head>

When I inspect a web page (even stackoverflow), I always see /* This is not a zero-length file! */ /* This is not a zero-length file! */ (yes, twice) at the bottom of the tag. Google gives no answer about that... Does it come from Chrome? What's the point? Edit Thanks the others for the answer. Th...
Sebastien
2

votes
1

answer
81

Views

Failure to emit css link html using html_receive and html_post

Trying to do something very straightforward.. emit some html with a link to my stylesheet, as explained here, on swi prolog page: Repositioning HTML for CSS and javascript links: http://www.swi-prolog.org/pldoc/man?section=html-post The only included library is: :- use_module(library(http/html_write...
magus
2

votes
2

answer
228

Views

Piwik tracking code breaks HTML Validation

I'm using Piwik to track visitors to my blog. Here is the Piwik tracking code: var _paq = _paq || []; _paq.push(['setDomains', ['*.example.com']]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u='//example.com/pwt/'; _paq.push(['setTrackerUrl', u+'piwik.php']);...
jjdreher
36

votes
5

answer
12.2k

Views

Do canonical links require a full domain?

I want to add canonical links to my pages, but do I need to specify the domain, or will a relative URL do? In other words, is: good enough, or do I need to use:
Richard
4

votes
2

answer
1.6k

Views

Can I Include different javascript/css files per Content Page using ASP.NET WebForms Master Pages?

I have several Content Pages using the same Master Page, that don't all need the same javascript and css files included in the tag. Is it possible to change the contents of the tag from the Content Pages?
aranasaurus
6

votes
1

answer
1.2k

Views

What happens if <base href…> is set with a double slash?

I like to understand how to use a value for my web crawler, so I tested several combinations with major browsers and finally found something with double slashes I don't understand. If you don't like to read everything jump to the test results of D and E. Demonstration of all tests: http://gutt.it/b...
mgutt
2

votes
1

answer
82

Views

why is thenextweb team page including an external php file with <script> tag

I was looking at thenextweb's team page and found that inside < head>, they are including an external php file within the < script> tag. Is this a good practice ? And what might be the purpose of doing this ? URL: http://thenextweb.com/about/team/ Code:
Ray Tsai
4

votes
1

answer
223

Views

How to add an element to the html head in an arbitrary sub-JSP page

So I have my main JSP page which includes a number of sub-JSP pages hierarchically. Some of these sub-JSP pages have scripts and styles that need to be included along with them, but I want the styles and the script tags to be in the head of the document. Is this possible without using JavaScript?
nikdeapen
7

votes
5

answer
5.7k

Views

<head> appears empty in Chrome

When browsing my website with last version of Google Chrome, and using F12 to look into the source, all the content between and appears empty. On last versions of Firefox and IE, everything appears correcyly. Actually the content is moved into the body on google Chrome. It's obviously not a CSS p...
PhilMarc
6

votes
1

answer
3.2k

Views

<noscript><img /> in <head> valid?

I'd like some advice on whether the following code is valid in the section of a website: I have been asked to add it to a website I look after but as far as I'm aware this means if JavaScript is disabled it will display an image to warn the user, but if I put it in the section it won't work will i...
mtwallet
1

votes
3

answer
2.2k

Views

Insert code into <head> using ASP.NET

I have some code that looks something like this: var params = {}; params.param1 = 'value1'; params.param2 = 'value2'; params.param3 = 'value3'; params.param4 = ''; // ASP.NET value 1 params.param5 = ''; // ASP.NET value 2 function.call(params); How do I use ASP.NET to populate param4 and param5? I'v...
JR.
8

votes
1

answer
17.1k

Views

Cache-control max-age meta tag not registering

I've put this in my head section. It appears in the page source in the browser. However, when I look in the Chrome extension Live HTTP Headers, it says the following. Cache-Control: max-age=0 Content-Encoding: gzip Content-Length: 5849 Content-Type: text/html; charset=utf-8 Date: Sat, 05 Apr 2014 04...
Nick
61

votes
4

answer
29.2k

Views

should Modernizr file be placed in head?

Should the reference to the Modernizr JavaScript file be in the head of the page? I always try and place all scripts on the bottom of the page and would like to preserve this. And if it needs to be in the head, why?
amateur
8

votes
2

answer
3.9k

Views

Using <noscript> within <head>: Good idea or bad idea?

I noticed Facebook does this where they have a meta refresh enclosed in a enclosed in the tag. They use this to detect if the user agent has javascript enabled or not. We were thinking of using this method for 2 reasons: To auto redirect to a non-js optimized version of the site as facebook does....
anonymous-one
4

votes
1

answer
1.3k

Views

How can I create a style element and append to head in React?

I'm currently learning React, and (more importantly) attempting to learn how react actually works. I have some generated css which I would like to append to head as a style element. In js land, this would be: const $style = document.createElement('style'); document.head.appendChild($style); const r...
Seph Reed
2

votes
1

answer
1.8k

Views

Manifest.json for progressive web app not working

I am trying to get the manifest.json file working for my web app. Unfortunately it is not working right. I am receiving the following error in the chrome devtools: Line: 1, column: 1, Unexpected token. I am pretty sure that the JSON is valid but it probably has something to do with the path in the...
Kevin Vugts
2

votes
4

answer
6.4k

Views

Load external script in <head> in Drupal 6

I want to load an external script in . It is module specific so I want my module to take care of the loading. In Drupal 6, function drupal_add_js() does not allow to add an external script in . It will be available in Drupal 7 passing the 'external' argument to the function. In D6, I can use drupal_...
Török Gábor
121

votes
10

answer
72.6k

Views

Does <STYLE> have to be in the <HEAD> of an HTML document?

Strictly speaking, do style tags need to be inside the head of an HTML document? The 4.01 standard implies that, but it's not explicitly stated: The STYLE element allows authors to put style sheet rules in the head of the document. HTML permits any number of STYLE elements in the HEAD section of a d...
eaolson
128

votes
5

answer
133.9k

Views

Necessary to add link tag for favicon.ico?

Are there any modern browsers that won't detect the favicon.ico automatically? Is there any reason to add the link tag for favicon.ico? My guess is that it's only necessary to include it in the HTML document if you decide to go with GIF or PNG...
user1087110
3

votes
1

answer
522

Views

Is it considered as bad practice to redirect in header with Javascript?

Let's assume that I load a filtering page, and based of an earlier set cookie, I want to reload the page by adding a few query parameters to my url. Something like this: if (need_to_load_with_different_params) { window.location.href = window.location.href + params_from_cookie; } I don't remember see...
DDan

View additional questions