23.7k views
2 votes
Use the writeln() method of the document object to display the user agent in a

tag in the webpage. Hint: The userAgent property of the window.navigator object contains the user agent.



User Alex Peda
by
5.8k points

1 Answer

1 vote

Answer:

Note that writeln() add a new line after each statement

var txt = "<p>User-agent header: " + navigator.userAgent + "</p>";

$("#agent").writeln(txt);

Then Anywhere in the body tag of the html file

create a div tag and include an id="agent"

User Daniel Sklenitzka
by
7.2k points