“JS bekommen Basis -URL” Code-Antworten

JS bekommen Basis -URL

var url = window.location.origin;
Skipper

Finden Sie die Basis -URL in JavaScript

var base_url = window.location.origin;

var host = window.location.host;

var pathArray = window.location.pathname.split( '/' );
Fine Frog

JS Root URL

suppose that you have a page with this address: http://sub.domain.com/virtualPath/page.htm. use the following in page code to achive those results:

window.location.host : you'll get sub.domain.com:8080 or sub.domain.com:80
window.location.hostname : you'll get sub.domain.com
window.location.protocol : you'll get http:
window.location.port : you'll get 8080 or 80
window.location.pathname : you'll get /virtualPath
window.location.origin : you'll get http://sub.domain.com *****
Wandering Walrus

JavaScript erhalten Basis -URL

console.log(window.location.origin);
Carnivorous Flamingo

Ähnliche Antworten wie “JS bekommen Basis -URL”

Fragen ähnlich wie “JS bekommen Basis -URL”

Weitere verwandte Antworten zu “JS bekommen Basis -URL” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen