File tree Expand file tree Collapse file tree 3 files changed +68
-1
lines changed Expand file tree Collapse file tree 3 files changed +68
-1
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ console . warn ( "--------------- Objeto URL(location) ---------------" ) ;
4
+
5
+ // Para empezar tenemos el objeto location
6
+ console . log ( location ) ;
7
+
8
+ // Para tener la url donde se origina la web, el documento
9
+ console . log ( location . origin ) ;
10
+
11
+ // Sirve para obtener el protocolo
12
+ console . log ( location . protocol ) ;
13
+
14
+ // Sirve para obtener la direccion IP y puerto de la web
15
+ console . log ( location . host ) ;
16
+
17
+ // Sirve para obtener la direccion IP o el nombre de dominio de tu web (esto depende si tienes levantada tu web)
18
+ console . log ( location . hostname ) ;
19
+
20
+ // Sirve para obtener el puerto por el que escucha el servidor (en este caso liveserver)
21
+ console . log ( location . port ) ;
22
+
23
+ // Sirve para obtener toda la URl completa de la web
24
+ console . log ( location . href ) ;
25
+
26
+ // Sirve para obtener el valor de la URL que esta despues de un hash
27
+ console . log ( location . hash ) ;
28
+
29
+ // Sirve para obtener el nombre del archivo que estoy consultando
30
+ console . log ( location . pathname ) ;
31
+
32
+ // Sirve para obtener los parametros de la url
33
+ console . log ( location . search ) ;
34
+
35
+ // -------------------------- Algunos Metodos --------------------------
36
+
37
+ // Sirve para recargar la pagina ciclicamente (Cuidado)
38
+ // location.reload();
39
+
40
+
41
+
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ console . warn ( "--------------- Objeto URL(location) ---------------" ) ;
4
+
5
+ // para empezar tenemos el objeto history
6
+ console . log ( history ) ;
7
+
8
+ // Sirve para mostrar cuantas paginas tenemos en el historial
9
+ console . log ( history . length ) ;
10
+
11
+ // Sirve para ir atras en el historial se puede poner la cantidad que quieras ir atras
12
+ console . log ( history . back ( 3 ) ) ;
13
+
14
+ // Sirve para ir adelante en el historial se puede poner la cantidad que quieras ir adelante
15
+ console . log ( history . forward ( 3 ) ) ;
16
+
17
+ // Sirve para ir adelante o atras en el historial
18
+ // para ir adelante
19
+ console . log ( history . go ( 3 ) ) ;
20
+ // para ir atras
21
+ console . log ( history . go ( - 3 ) ) ;
22
+
23
+
24
+
25
+
26
+
Original file line number Diff line number Diff line change 5
5
< meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
6
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
7
< title > BOM</ title >
8
- < script src ="./02_Metodos .js "> </ script >
8
+ < script src ="./04_Objeto_Historial(history) .js "> </ script >
9
9
</ head >
10
10
< body >
11
11
< h1 > BOM: Browser Object Model</ h1 >
You can’t perform that action at this time.
0 commit comments