【问题标题】:URI Decode with separate parameters带有单独参数的 URI 解码
【发布时间】:2017-07-13 23:14:25
【问题描述】:

如何解码 URI 并单独显示参数

检查附加的图像。 非常感谢任何参考。

【问题讨论】:

标签: angularjs


【解决方案1】:

你知道参数的名称吗?那你就可以这样做了

http://www.angulartutorial.net/2015/04/get-url-parameter-using-angular-js.html

您要解码的 url,是当前访问的站点还是用户在某个文本框中写入的 url?

那么这将是您的解决方案:https://stackoverflow.com/a/2880929/6629704 请注意查询 - 变量不应由 window.location 填充,而是由输入值填充

【讨论】:

    【解决方案2】:
    // Prints complete URL
    document.write(window.location.href);
    
    // Prints protocol like http: or https:
    document.write(window.location.protocol); 
    
    // Prints hostname with port like localhost or localhost:3000
    document.write(window.location.host);
    
    // Prints hostname like localhost or www.example.com
    document.write(window.location.hostname);
    
    // Prints port number like 3000
    document.write(window.location.port);
    
    // Prints pathname like /products/search.php
    document.write(window.location.pathname); 
    
    // Prints query string like ?q=ipad
    document.write(window.location.search);
    
    // Prints fragment identifier like #featured
    document.write(window.location.hash);
    

    来源:https://www.tutorialrepublic.com/javascript-tutorial/javascript-window-location.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-09
      • 1970-01-01
      • 2017-08-25
      相关资源
      最近更新 更多