关于javascript:获取网页网址(移动到其他页面而不更改网址)

get webpage URL(moving to other page without changing URL)

网址是http://bbn.kiwoom.com/bbn.corpAnalCRList.do(不是我的网站)

我想得到网页URL(图2),你可以通过点击红框或调用js function(green box)来移动它,就像图1.

图片1


我想你想要什么,你可以使用 angular ng-include 或 object/iframe 轻松完成:

1
2
3
4
5
6
7
8
9
10
(function(angular) {
  'use strict';
angular.module('includeExample', ['ngAnimate'])
  .controller('ExampleController', ['$scope', function($scope) {
    $scope.templates =
      [ { name: 'pic1.html', url: 'https://www.google.com.br'},
        { name: 'pic2.html', url: 'http://www.google.com.br'} ];
    $scope.template = $scope.templates[0];
  }]);
})(window.angular);

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.1/angular.min.js">
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.1/angular-animate.js">
 
<body ng-app="includeExample">
 
  <select ng-model="template" ng-options="t.name for t in templates">
   <option value="">(blank)</option>
  </select>
  url of the template: <wyn>{{template.url}}</wyn>
  <hr/>
 
   
     <object type="text/html" data="{{template.url}}"
            style="width:100%; height:100%; margin:1%;">
    </object>
 

</body>

(空白的)

模板的网址:{{template.url}}

https://docs.angularjs.org/api/ng/directive/ngInclude


您可以使用客户端路由 - 更改 url 哈希标记。看看这个小的 js 库 http://sammyjs.org/

您定义了您的详细路线,处理此路线您将显示您的详细信息。