0
我試圖打開一個whats'app鏈接,我得到這樣的錯誤:離子2:獲得不安全網址錯誤
WARNING: sanitizing unsafe URL value SafeValue must use
(see http://g.co/ng/security#xss)
這裏是我的代碼:
<a href="{{surl}}">
<img src="assets/imgs/whatsapp.png" height=35px/></a>
和TS文件這裏是什麼SURL認爲:
this.url = 'whatsapp://send?text=Hello World!&phone=+966'+this.phone
this.surl = this.dom.bypassSecurityTrustUrl(this.url);
,你可以告訴的問題是,我傳遞一個變量的url,但科爾多瓦不會信任它! 任何想法如何解決這個問題?
看看這個主題https://stackoverflow.com/questions/38593515/angular2-warning-sanitizing-unsafe-style-value-urlsafevalue-must-use-proper –
@ChristianBenseler他們說我應該包裝整個網址,這正是我所做的:( –
如果你嘗試把它直接放在視圖中,如下所示: '' Where 'url' is set in the component code like 'this.url = 'whatsapp://send?text=Hello World!&phone=+966' + this.phone;' – sebaferreras