noscript

Loading assets in a noscript element

对着背影说爱祢 提交于 2019-12-13 07:16:19
问题 I expect the standard behavior would be to not load any assets in a <noscript> element, and a quick cursory test in FF and Chrome proves this to be the case. However, are there any situations where assets (e.g. an image) in a <noscript> element, would be loaded when scripts are enabled? 回答1: According to W3 specifications : The NOSCRIPT element allows authors to provide alternate content when a script is not executed. The content of a NOSCRIPT element should only be rendered by a script-aware

大多数前端工程师了解但并不擅长的HTML语义化

时光怂恿深爱的人放手 提交于 2019-12-13 00:01:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 下面两段代码从HTML语义化的角度来看有什么问题? <!-- more --> <!-- 示例1 --> <label>作者: <input type="author" texture="deep pile"></label> <!-- 示例2 --> <body> <h1>【深度】扒开V8引擎的源码,我找到了你们想要的前端算法</h1> <h2>下次面试官再问算法,用它怼回去!</h2> ... 读者可以先试试将上面例子中的代码进行语义化,再来看文末的答案。 HTML 语义化(按照 W3C 规范正确地使用标签元素和其属性,以下简称“语义化”,HTML 指 HTML5)被很多文章提到,但内容大多是先宣传语义化的必要性,然后劝说读者在开发中多使用语义化标签。 本文不宣传必要性, 也不卖力推荐大多数读者能写出语义化的代码,只对语义化的现状进行探究,并给出可行的语义化操作方式。 语义化的现状 我们以非语义化标签的滥用为例来看看目前网页的语义化程度。 非语义化的标签其实只有两个 div 和 span,本来这两个标签只是作为默认标签的补充,但现实是它们的使用频率却远超其它语义化标签。 下面是一段统计标签数量的 js 脚本,用它可以统计出网页上各个标签数量和占比。 打开浏览器控制台,执行下面的代码就可以得到结果。 var

Redirect if no JavaScript [duplicate]

夙愿已清 提交于 2019-12-12 06:09:23
问题 This question already has answers here : No-Javascript Detection Script + Redirect (4 answers) Closed 6 years ago . Here's my situation: I'm trying to redirect users with JavaScript disabled to a PHP generated page (instead of an AJAX generated page) on my Apache server. I'm currently using: <noscript> <meta http-equiv="refresh" content="0; url=http://mydomain/no_js.php"> </noscript> Is there a way to redirect users BEFORE the page loads? P.S.: If not then any way faster than the one I'm

Check if certain text was outputted to the screen PHP

僤鯓⒐⒋嵵緔 提交于 2019-12-11 11:38:54
问题 How would I check if certain text was outputted to the screen using PHP? For example, I have this code: <html> <body> <noscript> error: no js <noscript> <?php //detect if the HTML printed out "error: no js" ?> </body> </html> I want to detect if HTML printed out the specified <noscript> message. Is this possible to do with PHP, or on a PHP page? Is there a better way to stop any scripts if JavaScript is disabled, or if certain output was outputted? I would especially like to do this because

In HTML webpage, the content within noscript tags are not getting rendered by browsers with script blocking extension

浪尽此生 提交于 2019-12-10 16:35:11
问题 In HTML webpage, the content within noscript tags are not getting rendered by browsers with script blocking extension. I have a page http://www.zen76171.zen.co.uk/aaa2.html with this HTML <!doctype html> <html> <head> <noscript>aaa</noscript> <script>document.write("bbb")</script> </head> <body> ccc </body> </html> I understand that the contents of the noscript tag should run if a browser is not running javascript. In chrome or firefox, with no extensions blocking anything, I get the output

How to get content of <noscript> in Javascript in IE7?

冷暖自知 提交于 2019-12-09 07:35:57
问题 I'm trying to get the content of a <noscript> tag using Javascript. I succesfully managed to get it in FF, Chrome, Opera and even IE6 but fail on IE7 (haven't tried IE8+ yet). Basically, here's the reduced code version : <noscript>Lorem ipsum</noscript> <script> var noscript = document.getElementsByTagName('noscript')[0]; noscript.textContent; // undefined noscript.innerHTML; // empty string noscript.childNodes.length; // 0 </script> I tried adding element inside and targeting them, no

Can googlebot do basic javascript? [duplicate]

拈花ヽ惹草 提交于 2019-12-08 18:52:29
This question already has answers here : Do Google's crawlers interpret Javascript? What if I load a page through AJAX? [closed] (8 answers) Closed 5 years ago . Suppose I have something like this page: <noscript>You need JS for this page</noscript> <script> document.write('you have javascript'); $(function() { /* Some DOM heavy coding */ }); <script> What will this look like to google? If someone searches google for "you have javascript" will they see my page? The safest answer is: don't rely on it. In particular because you're doing heavy DOM coding. If the code must be in Google for search

Can googlebot do basic javascript? [duplicate]

自闭症网瘾萝莉.ら 提交于 2019-12-08 04:26:10
问题 This question already has answers here : Do Google's crawlers interpret Javascript? What if I load a page through AJAX? [closed] (8 answers) Closed 5 years ago . Suppose I have something like this page: <noscript>You need JS for this page</noscript> <script> document.write('you have javascript'); $(function() { /* Some DOM heavy coding */ }); <script> What will this look like to google? If someone searches google for "you have javascript" will they see my page? 回答1: The safest answer is: don

How to detect if browser JavaScript is off and display a notice

假如想象 提交于 2019-12-08 02:36:14
问题 I need to check if browser JavaScript is off, then display a error div instead of the body, how can I do this? 回答1: <html class="no-js"> <head> <style> .error, .no-js #container { display: none; } .no-js .error { display: block; } </style> <script> document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/, ''); </script> </head> <body> <div id="container"> rest of page </div> <div class="error"> sorry, no javascripty, no sitey! </div> </body> </html> Of

Detecting whether there's overflow or not WITHOUT javascript

此生再无相见时 提交于 2019-12-06 14:05:17
问题 I want to know if there's a HTML/CSS only way to detect (or at least, show/hide some elements with pseudo classes etc.) to take action when an element's contents overflow (in vertical only). Yes, I KNOW it can be done and I KNOW how to do it (I don't need JS examples on this, PLEASE), I just want to know if there's a clever way, without any javascript. I'm trying to show a "more..." button which will appear ONLY when there's overflow, and trying to achieve this without JS if possible. 回答1: