Pergunta

Is there is a way to add the extra empty spaces while viewing source. I am not asking for hiding the source. I want to add the extra white space in the source code when you view. http://www.immihelp.com/visitor-visa/sponsor-documents.html. If you visit the site click view source then it appear with empty white space. Is there is a way to do this in jquery or javascript.

Any suggestion would be great.

Thanks.

Foi útil?

Solução 2

You can't do it with JavaScript. You can, however, do it with PHP, or my recommendation: press enter a lot of times.

For example, 100 new lines in PHP.

<!DOCTYPE html>
<?php echo str_repeat("\n", 100); ?>
<html>
    ...
</html>

Outras dicas

No. JavaScript/jQuery is run by the browser after it has parsed the HTML. There's no way for it to modify the HTML of the webpage, as what you see when you view the source is sent by the webserver.

Besides, if someone is viewing the source code, I think they can notice a scrollbar or know that webpages can't hide their source code.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top