Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the contents of a script tag be cut off if it's too long?

If I view the source of a certain webpage, there is a script tag that seems to be cut off at the end, ending with an ellipsis (...). Is there a way to tell if the script is actually being cut off or if the ellipsis is actually part of the content? If it is cut off, is there a way to view the whole thing?

enter image description here

like image 406
Cristiano Avatar asked Oct 29 '14 19:10

Cristiano


People also ask

How will you close the script tag after completing the code?

Always end with a body tag and make sure every single JavaScript part is within the body tag. You can also have links or scripts inside head tags, but it is not recommended unless you are really certain your JavaScript code is too big to have it inline.

Should script tags be body?

The best practice is to put JavaScript <script> tags just before the closing </body> tag rather than in the <head> section of your HTML. The reason for this is that HTML loads from top to bottom. The head loads first, then the body, and then everything inside the body.

Can we write script tag outside body?

JavaScript files have file extension . js . To use an external script put the name of the script file in the src attribute of a script tag. External scripts cannot contain script tags.

Should scripts be head or body?

If your is not placed inside a function, or if your script writes page content, it should be placed in the body section. It is a good idea to place scripts at the bottom of the <body> element. This can improve page load, because script compilation can slow down the display.


2 Answers

Yes, it appears that Chrome Developer tool truncates the display of the content and shows an ellipses instead. The content is still there and parsed by the browser.

You can view the full content by going to the Sources tab, clicking on the Show Navigator icon, and selecting your file.

like image 190
foishii Avatar answered Sep 17 '22 06:09

foishii


The previous answers do not work if js code added dynamically. For me works when I do right click on script element and choose Copy -> Copy element

Screenshot

like image 40
Marina Sokolova Avatar answered Sep 17 '22 06:09

Marina Sokolova