noscript

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

久未见 提交于 2019-12-06 11:04:13
I need to check if browser JavaScript is off, then display a error div instead of the body, how can I do this? <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 course, this is usually a bad idea, but I hope you've already considered that. You'll need to do it the other way

Display a “No Javascript” div, but not to google / facebook share service

走远了吗. 提交于 2019-12-06 08:03:36
问题 I would like to show a div near the top of a site to suggest to visitors that do not have javascript enabled that they should enable their javascript. I thought I had found a good method by using the noscript tag. Unfortunately I found that this solution was less than ideal because of services like Google's indexer and Facebook's link sharing functionality. These services scrape the page and read the text in the noscript div as the summary of the page. This happens because these services are

Making HTML content expand to fill the window

烈酒焚心 提交于 2019-12-05 16:56:54
问题 I have an HTML page divided vertically into Header Body Footer The body in turn is divided horizontally into A large DIV on the left surrounded by scrollbars, displaying a portion of a diagram A form on the right The header and footer are fixed-height. The body should expand vertically to fill the portion of the window not occupied by the header and footer. Similarly the form is fixed-width and the scroll pane should expand horizontally to fill the window width. The diagram is very large (up

Does noscript content load in bg

与世无争的帅哥 提交于 2019-12-05 06:50:38
Does the html tag noscript load the content in the background, even when javascript is enabled? I have a random image that is called by JS each time the pageloads, but I would like all of the links (not just the current random one) to be crawled. At the same time, I don't want the pageload to slow down because images are loading in the background like they do with display:none. I also want to call these images and links in the html because of CMS reference issues with Javascript. Image references in NOSCRIPT tags are not loaded at all when Javascript is enabled. You can test this my making a

Detecting whether there's overflow or not WITHOUT javascript

不羁岁月 提交于 2019-12-04 19:53:40
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. 100% height solution Here's a version of this solution for 100% height - so when content tries to take up more

Display a “No Javascript” div, but not to google / facebook share service

折月煮酒 提交于 2019-12-04 16:38:31
I would like to show a div near the top of a site to suggest to visitors that do not have javascript enabled that they should enable their javascript. I thought I had found a good method by using the noscript tag. Unfortunately I found that this solution was less than ideal because of services like Google's indexer and Facebook's link sharing functionality. These services scrape the page and read the text in the noscript div as the summary of the page. This happens because these services are not utilising javascript (obviously). So, my question to the masses is: What techniques do you prefer

What purpose does a <script> tag serve inside of a <noscript> tag?

血红的双手。 提交于 2019-12-04 07:27:44
问题 I've been on a "view source" spree lately on websites with interesting design and content. One of those websites, Squarespace, has blocks of <script> tags inside of a <noscript> tag, like so: <!-- Page is at: http://squarespace.com --> ... ... <noscript id="inline-deps"> <link rel="stylesheet" type="text/css" href="//cloud.typography.com/7811972/758964/css/fonts.css" /> <script type="text/javascript" src="https://static.squarespace.com/static/ta/5134cbefe4b0c6fb04df8065/7400/assets/logomark

Making HTML content expand to fill the window

爱⌒轻易说出口 提交于 2019-12-04 03:00:49
I have an HTML page divided vertically into Header Body Footer The body in turn is divided horizontally into A large DIV on the left surrounded by scrollbars, displaying a portion of a diagram A form on the right The header and footer are fixed-height. The body should expand vertically to fill the portion of the window not occupied by the header and footer. Similarly the form is fixed-width and the scroll pane should expand horizontally to fill the window width. The diagram is very large (up to 10x10 screenfuls) so I cannot display all of it. Instead I want to display as much as possible

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

怎甘沉沦 提交于 2019-12-03 09:30:07
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 success. I tried to wrap in a parent element and getting its .innerHTML , but anything between <noscript>

How to hide parts of HTML when JavaScript is disabled?

拜拜、爱过 提交于 2019-12-03 05:08:01
I'm trying to accommodate users without JavaScript. (By the way, is it worth the effort nowadays?) In one HTML file I'd like part of it execute if scripts are on , and another part if scripts are OFF. The <noscript> tag lets me do the former, but how to achieve the latter? How can I mark a part of HTML so that it is not parsed by browser if scripts are off ? here's a video tutorial on how this can be done with jQuery: http://screenr.com/ya7 Code: <body class="noscript"> <script> $('body').removeClass('noscript'); </script> </body> And then just hide the relevant elements under body.noscript