Get Windows objects such as URLs, port numbers, etc., timed to show up

Source: Internet
Author: User

<! DOCTYPE html>
<meta charset= "UTF-8" >
<script type= "Text/javascript" src= "Angular.js" ></script>
<script>
var app = Angular.module ("MyApp", []);
App.controller ("Myctrl", Function ($scope, $timeout) {
Get width
var wd = Window.screen.width;
$timeout (function () {
$scope. widths = WD;
},2000);

Get height
var hg = Window.screen.height;
$timeout (function () {
$scope. Heights = HG;
},2000);

Get title
var tt = document.getElementById ("Biaoti"). InnerHTML;
$timeout (function () {
$scope. titles = TT;
},3000);

Get URL Protocol
var ur = window.location.protocol;
$timeout (function () {
$scope. urls = ur;
},3000);

Get URL Host
var hs = Window.location.host;
$timeout (function () {
$scope. URLSS = HS;
},3000);

Get Port number
var po = window.location.port;
$timeout (function () {
$scope. Dkhs = PO;
var CF = confirm ("Whether the port number is displayed");
if (cf==true) {
$scope. Dkhs = PO;
}
},5000);

Get the hash portion of the URL
var ha = Window.location.pathname.hash;
$timeout (function () {
$scope. Dkhs = PO;
var CF = confirm ("Whether to show the hash portion of the url");
if (cf==true) {
$scope. hashs = ha;
}
},5000);

Get access Address
var pn = Window.location.pathname;
$timeout (function () {
$scope. Dkhs = PO;
var CF = confirm ("Show access Address");
if (cf==true) {
$scope. DZs = PN;
}
},5000);

});

</script>
<title id= "Biaoti" >123</title>
<body ng-app= "MyApp" ng-controller= "Myctrl" >
<p> Frequency screen width is:{{widths}}</p>
<p> frequency screen height is:{{heights}}</p>
<p> Page title is:{{titles}}</p>
The <p>url protocol is:{{urls}}</p>
<p>url Host is:{{urlss}}</p>
<p> Port number is:{{dkhs}}</p>
The hash part of <p>url is:{{hashs}}</p>.
<p> Access address is:{{dzs}}</p>
</body>

Get Windows objects such as URLs, port numbers, etc., timed to show up

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.