【发布时间】:2020-05-28 11:23:28
【问题描述】:
尝试将值作为 iframe url 从本地数据库传递,并且我收到错误消息: 资源 URL 上下文中使用的不安全值。 我正在尝试显示一系列打印机 ip,这样我就可以通过网站检查它们的状态,无论如何在没有 iframe 的情况下可以做到这一点? 我会很高兴听到一些建议。
我是 Angular 的新手,每一个帮助都更受欢迎 提前致谢。
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-value',
templateUrl: './value.component.html',
styleUrls: ['./value.component.css']
})
export class ValueComponent implements OnInit {
values: any;
constructor(private http: HttpClient, private sanitizer: DomSanitizer) { }
ngOnInit() {
this.getValues();
}
getValues() {
this.http.get('http://localhost:5000/api/values/').subscribe(response => {
this.values = response;
}, error => {
console.log(error);
})
}
}
<H2>Print Manager</H2>
<div id="outerdiv">
<iframe src="http://192.168.1.6/general/status.html" id="inneriframe" scrolling="no" ></iframe>
</div>
<div *ngFor="let value of values">
<p>{{value.id}},{{value.hostName}},{{value.location}},{{value.manufacturer}},{{value.ip}}</p>
<span>Hostname: {{value.hostName}}</span>
<br>
<span>Location: {{value.location}}</span>
<br>
<span>Manufacturer: {{value.manufacturer}}</span>
<br>
<span>IP: {{value.ip}}</span>
</div>
【问题讨论】:
标签: javascript html asp.net angular typescript