This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to detect if JavaScript is disabled?
My question is how to detect in the server side web application that there is no javascript enabled?
I know the tag but I want to do it in servlet or with pure java. I do not want to use noscript tag
because I have to redirect the page if there is not javascript enalbed.
Thanks in advance.
OK I found a way to do it.
Make two div tags.
The first one will contain the noscript text
and the second one will contain the main content of the page.
With javascript you just have to hide the one div and to show the other. If there is no javascript the div with the text won't dissapear and the other won't show.
Related
This question already has answers here:
How to add meta tag in JavaScript
(5 answers)
Closed 3 years ago.
I want to add meta tag conditionally in an HTML page, i am not sure if it is ok to do so or not using jQeruy ready even. The example is given bellow.
var myHost = window.location.host;
if(myHost.startsWith("techstag")) {
$("head").append('<meta name="robots" content="noindex,nofollow">');
}
In short, it may or may not work.
It would work in the sense you'll see the meta tag in page when you inspect it.
But, if you are intending to do this for SEO purposes
For the most part, it won't work, as most web crawlers do not execute javascript while scanning the web pages.
It will work for crawlers that do execute JS (e.g. Google's)
This question already has answers here:
Can we hide javascript loading from the user?
(2 answers)
Closed 4 years ago.
So this is how it goes... I wanted to create a javascript that redirects links to my URL. So if anyone copies my webpage, they try changing my links, when they upload it to their server, her links will still redirect to my links. Is this possible with js? Or if I use PHP to hide the location of my js. I want that js to still work in the webpage they copied and use. Like a sticky clickjacker. That's hard to find and remove. Or if possible they cant at all.
I wanted to create a javascript that redirects links to my url.
This means that the user would have to already be at your URL because the JavaScript to redirect to your URL can only be added to pages that you control.
So if anyone copies my webpage, they try changing my links, when they
upload it to their server, her links will still redirect to my links.
As soon as they make a copy of your code, it's their code and they can upload it anywhere they want without your knowledge. And, if they can change your links, they can also just remove any JavaScript you may have had in the file.
What you want to do is not possible.
This question already has answers here:
Clear HTML page using JavaScript
(2 answers)
Closed 5 years ago.
I have a webpage with a story line. Half way in the story the "narrator" says he will take away everything on the page. How do I do that? In command form obviously. And I want it to be just temporary, reload the page and it will be fine.
And in javascript
thanks
One way for clearing your page is this:
<script type="text/javascript">
document.body.innerHTML = '';
</script>
Just make sure the above code to insert it just before the closing </body> tag.
This question already has answers here:
Can an iframe only show a certain part of the page?
(8 answers)
Closed 8 years ago.
I am trying to build a webpage using wix.com, and I want to include part of another website into mine. I can add html code. I am trying to get the featured poet on poetryoutloud.org into mine. This changed everyday and I only want this part of the webpage. I know that if I wanted to include the whole webpage I could use an iframe element, but this is only part of it
You can use an iframe
or alternatively you can use ajax, here an example using jQuery.
$("#yoursite-html").load("yoursite-html.php");
Please note if content is on another domain as described in your answer (CORS issue), you have to use a simple proxy example below:
PHP in file "yoursite-html.php":
echo file_get_contents("http://www.yoursite.com/");
This question already has answers here:
Where should I put <script> tags in HTML markup?
(21 answers)
Closed 8 years ago.
I need to load lot of libraries on the html pages in my project.But I came across through many sources that placing the script tag before the closing the body tag improves the loading performance.If it is true,I would like to the concept behind this.
Thanks in advance,
Krish
The browser doesn't know if your script changes the DOM structure, so it blocks the rendering of the page if it encounters a <script> tag. By placing the script tags at the bottom, the browser can render the whole page, so the content is shown earlier to the user.