-1

I have specific javascript code

   <script type="text/javascript" async="true" data-ad-type="iframe v2.0" charset="utf-8" src="//mydomaincom.com/generic/uni.php?g=5"></script>

that work on all pages, but on /ucp.php?mode=register I dont want to execute the code. How to do this?

I made this code but not working (two script inside?)

<script>
  if ( window.location.pathname == '/ucp.php?mode=register'{ 
     } else {
          <script type="text/javascript" async="true" data-ad-type="iframe v2.0" charset="utf-8" src="//sk.search.etargetnet.com/generic/uni.php?g=5"></script>
     }
</script>

The answer should be with PHP too, if with PHP i can make it.

1 Answers1

1

Try this.

if ( window.location.pathname != '/ucp.php'){ 
    var fileref=document.createElement('script')
            fileref.setAttribute("type","text/javascript")
            fileref.setAttribute("src","//sk.search.etargetnet.com/generic/uni.php?g=5")
    fileref.setAttribute("async","true")
    fileref.setAttribute("data-ad-type","iframe v2.0")
    fileref.setAttribute("charset","utf-8")

         }
saravanan mp
  • 745
  • 3
  • 16
  • 34