//get base URL
            var _urlstr = window.location.href;
            if (_urlstr.indexOf("?") > -1) {
                _urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("?"));
            }
            _urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("/"));
            _urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("/"));

例如:http://localhost:1781/tool/yakujihou.aspx

_urlstr为:http://localhost:1781

获取网站的BaseURL的更多相关文章

  1. PHP获取网站图标(favicon.ico)文件

    有的网站源码中加入了这几行代码: <link rel="shortcut icon" href="/favicon.ico" type="ima ...

  2. 曲线救国:IIS7集成模式下如何获取网站的URL

    如果我们在Global中的Application_Start事件中访问HttpContext.Current.Request对象,如: protected void Application_Start ...

  3. 使用PHP获取网站Favicon的方法

    使用PHP获取网站Favicon的方法 Jan022014 作者:Jerry Bendy   发布:2014-01-02 23:18   分类:PHP   阅读:4,357 views   20条评论 ...

  4. js获取网站根目录

    //js获取网站根路径(站点及虚拟目录),获得网站的根目录或虚拟目录的根地址         function getRootPath(){        var strFullPath=window ...

  5. php获取网站根目录

    php获取网站根目录方法一:<?phpdefine("WWWROOT",str_ireplace(str_replace("/","\\&quo ...

  6. 【ASP.NET】获取网站目录的方法

         获取网站物理路径: HttpRuntime.AppDomainAppPath 获取网站虚拟路径: HttpRuntime.AppDomainAppVirtualPath

  7. .net 获取网站根目录总结

    一.获取网站根目录的方法有几种如: Server.MapPath(Request.ServerVariables["PATH_INFO"]) //页面详细路 Server.MapP ...

  8. php用正则表达式获取网站的标题内容

    已知网站的网址,用php获取网站的内容. 编写正则表达式. 用preg_match_all函数获取标题内容. $url='http://www.m-ivi.com'; $content=file_ge ...

  9. 使用curl获取网站的http的状态码

    发布:thebaby   来源:net     [大 中 小] 本文分享一例shell脚本,一个使用curl命令获取网站的httpd状态码的例子,有需要的朋友参考下.本文转自:http://www.j ...

随机推荐

  1. why not ovp protection ?

    HW MSM8917 PM8937 PMI8940 Question : Recently, I connect usb cable with 10V to the phone. Why does t ...

  2. 复制View对象

    
Mark一下 - (UIView*)duplicate:(UIView*)view { NSData * tempArchive = [NSKeyedArchiver archivedDataWit ...

  3. LeetCode OJ-- Longest Common Prefix

    https://oj.leetcode.com/problems/longest-common-prefix/ 在多个string的集合中,找出所有string的最长公共前缀. 从头开始 index ...

  4. 转载自——Json.Net如何在序列化之前修改属性值

    今天写一个Json.net比较偏门的用法,也许你很久都用不到,也许你明天就能派上用场. 我们都知道 Json.net 序列话的用法 Test test = new Test() { A = " ...

  5. Write a function that generates one of 3 numbers according to given probabilities

    You are given a function rand(a, b) which generates equiprobable random numbers between [a, b] inclu ...

  6. UVA - 1205 Color a Tree

    大意就是给你一颗树,每个点有一个权值w[i],求一个排列使得 所有的父亲都在儿子前面 并且排列的权值最小. 排列的权值在这里定义为 Σ i * w[p[i]]   ,其中p[i] 是排列第i个位置的元 ...

  7. 查看tomcat启动文件都干点啥---Catalina.java

    在前一章查看tomcat启动文件都干点啥---Bootstrap.java中我们得出结论,在Bootstrap中通过反射调用Catalina类中的getServer,start,stop,stopSe ...

  8. Concurrency(Locking, Blocking and Row Versioning)

    https://www.simple-talk.com/sql/t-sql-programming/row-versioning-concurrency-in-sql-server/?utm_sour ...

  9. mysql二进制安装,升级,多实例部署

    目标 理解线上部署考虑的因素 学会编译安装以及二进制安装mysql 学会升级mysql 学会多实例部署mysql数据库 学会合理部署mysql线上库   考虑因素: 版本选择,5.1,5.5还是5.6 ...

  10. django发送邮件配置

    配置如下,settings中配置: EMAIL_HOST = 'smtp.163.com' EMAIL_PORT = '25' EMAIL_HOST_USER = 'contact108@163.co ...