I'm running the development server on localhost:8000. Can document.domain include a port number, e.g., document.domain = 'localhost:8000'? I seem to be getting an error saying localhost:8000 cannot be parsed properly.
            Asked
            
        
        
            Active
            
        
            Viewed 2,113 times
        
    0
            
            
         
    
    
        John M.
        
- 2,642
- 7
- 26
- 55
- 
                    *"...seem to be..."*? – T.J. Crowder Nov 21 '17 at 15:27
- 
                    A **domain** doesn't contain a port, so...no. More: https://developer.mozilla.org/en-US/docs/Web/API/Document/domain – T.J. Crowder Nov 21 '17 at 15:28
- 
                    https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy – Nov 21 '17 at 15:28
1 Answers
2
            No. The document.domain includes only the host name.
document.domainGets/sets the domain portion of the origin of the current document, as used by the same origin policy.
Alternatively, location.port gets you the port of the domain.
- 
                    document.domain sets the domain portion used by the same origin policy. Hoe to set the port portion used by same origin policy? – Nithin Kumar Biliya Nov 29 '20 at 15:39

 
    