Home  >  Article  >  Web Front-end  >  How to use domain attribute

How to use domain attribute

不言
不言Original
2019-02-13 16:15:083155browse

The domain attribute can return the domain name of the server for downloading the current document. Let's take a look at the specific methods of the domain attribute.

How to use domain attribute

#The domain attribute is a read-only string that contains the host name of the web server that is loading the current document.

Let’s first take a look at the basic syntax of the domain attribute

document.domain

Note: The domain attribute can solve the attribute sharing problem of different documents caused by the same-origin security policy.

Let’s look at the specific examples

The code is as follows

<!DOCTYPE html>
<html>
<body>
本文档的域名是:
<script type="text/javascript">
document.write(document.domain)
</script>
</body>
</html>

This article ends here. For more exciting content, you can pay attention to other posts on the php Chinese website Related column tutorials! ! !

The above is the detailed content of How to use domain attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn