we got some issues when downloaded and run web notify sample code in java script

My changes:

Added UA delegate methods couple of code into snippet.html

<script type="text/javascript">
// 86acbd31cd7c09cf30acb66d2fbedc91daa48b86:1511858682.01
!function(n,t,c,e,u){function r(n){try{f=n(u)}catch(n){return h=n,void i(p,n)}i(s,f)}function i(n,t){for(var c=0;c<n.length;c++)d(n[c],t);
}function o(n,t){return n&&(f?d(n,f):s.push(n)),t&&(h?d(t,h):p.push(t)),l}function a(n){return o(!1,n)}function d(t,c){
n.setTimeout(function(){t(c)},0)}var f,h,s=[],p=[],l={then:o,catch:a,_setup:r};n[e]=l;var v=t.createElement("script");
v.src=c,v.async=!0,v.id="_uasdk",v.rel=e,t.head.appendChild(v)}(window,document,'https://web-sdk.urbanairship.com/notify/v1/ua-sdk.min.js',
'UA', {
appKey: xxxxx,
token: xxxxxx,
vapidPublicKey: xxxxx
});


UA.then(function(sdk) {
alert(sdk.channel.id)
}).catch(function(err) {
console.log(err)
})

// Multiple calls have no additional expense.
UA.then(function(sdk) {
$('#register').show()
$('#register').click(function(ev) { sdk.register() })
})

</script>

 

Issues:

A bad HTTP response code (404) was received when fetching the script.
/push-worker.js Failed to load resource: net::ERR_INVALID_RESPONSE   //https://web-sdk.urbanairship.com/notify/v1/ua-sdk.min.js not loaded

 

 

we got above errors.please update how to run web notify java script code  

Didn't find what you were looking for?

New post

Comments

1 comment

  • Hello,

    Have you followed the steps in our Platform Guide for Web Notify?

    Specifically have you placed the push-worker.js file in the root directory of your website or updated the JavaScript Snippet if you are unable to place it at the root (Service Worker Location)?

    Also are you hosting on HTTPS? If you are unable to do so you will need to implement the Secure Domain Bridge.

    Comment actions Permalink

Please sign in to leave a comment.