Advertisement
Guest User

Recuperando URL Base

a guest
Nov 28th, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.     // Metodo 1
  3.     if( typeoff location.origin === 'undefined' ){
  4.         location.origin = location.protocol + '//' + location.host
  5.     }
  6.  
  7.     // Metodo 2
  8.     if( !location.origin ){
  9.         location.origin = location.protocol + '//' + location.host
  10.     }
  11.  
  12.     // Metodo 3
  13.     path = location.href.split('/');
  14.     protocol = path[0];
  15.     host = path[2];
  16.     base = protocol + '//' + host;
  17.  
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement