如何隐藏/显示基于url栏的调查弹出?



有两个应用程序。我的应用程序是使用Angular作为前端http://test.com/search编写的。我的应用程序包含javascript文本,当用户访问我们的网站时弹出调查。

有另一个应用程序B say - http://test.com/search?dodhaLink=true,用户也可以从那里访问我的应用程序。

我想要实现的是当我的应用程序从应用程序B调用,然后不显示弹出窗口。

Qualtrics javascript text in .html file

<div>
<!--BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET-->
<script type='text/javascript'>
(function(){var g=function(e,h,f,g){
this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0};
try{(new g(100,"r","QSI_S_ZN_cwOHfLkxRr4n4W2","https://zncwohflkxrr4n4w2-nlmenterprise.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_cwOHfLkxRr4n4W2")).start()}catch(i){}})();
</script><div id='ZN_cwOHfLkxRr4n4W2'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>
<!--END WEBSITE FEEDBACK SNIPPET-->
</div>

您可以使用window.location.href,以便从javascript检查页面的URL。

所以你可以试试:

if('http://test.com/search'.equals(window.location.href))
{
// display survey
}