-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWindow_Object.js
More file actions
67 lines (50 loc) · 2.17 KB
/
Window_Object.js
File metadata and controls
67 lines (50 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
window.open("mailto:example@domain.com?subject=Test&body=Test&cc=anotheremailaddress@anotherdomain.com&bcc=onemore@anotherdomain.com");
window.open("http://www.dotnetfunda.com", "", "width=200,height=300");
var book = new Object(); // Create the object
book.subject = "Perl"; // Assign properties to the object
book.author = "Mohtashim";
document.write("Book name is : " + book.subject + "<br>");
document.write("Book author is : " + book.author + "<br>");
window.print();
window.location.href= "steadyadvice.net";
window.location // To get full location details
window.location.host // To Get current URL
window.location.assign("http://www.abc.org"); // assign URL
window.location.replace("http://www.abc.com"); // loads a new document in the browser window
location.reload(); // To refresh browser
window.onerror = function (msg, url, line) {
document.write("An error occurred.");
document.write("Message : " + msg);
document.write("url : " + url);
document.write("Line number : " + line);
}
function imageAvailble(url, callback) {
var img = new Image();
img.onload = () => { callback(true); };
img.onerror = () => { callback(false); };
img.src = url;
}
var imageUrl = 'http://www.google.com/images/srpr/nav_logo14.png';
this.imageAvailble(imageUrl, function(exists) {
console.log('FINAL RESULT: url=' + imageUrl + ', exists=' + exists);
});
window.history.forward();
window.innerWidth; or
document.documentElement.clientWidth; or
document.body.clientWidth;c
window.innerHeight; or
document.documentElement.clientHeight; or
document.body.clientHeight
console.log(screen.width + ' x ' + screen.height);
function getDevice() {
//innerWidth returns the width of a window's content area.
//cross browser solution window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
// window.innerHeight | document.documentElement.clientHeight || document.body.clientHeight;
return window.innerWidth < 600 ? 'mobile' : 'desktop';
}
// if (!this.hide) {
// window.resizeTo(200, 200)
// } else {
// window.resizeTo(441, 819)
// }
// this.hide = !this.hide;