Get service worker JavaScript
curl --request GET \
--url https://push.platform.arb.inc/demo/sw.jsimport requests
url = "https://push.platform.arb.inc/demo/sw.js"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://push.platform.arb.inc/demo/sw.js', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://push.platform.arb.inc/demo/sw.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://push.platform.arb.inc/demo/sw.js"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://push.platform.arb.inc/demo/sw.js")
.asString();require 'uri'
require 'net/http'
url = URI("https://push.platform.arb.inc/demo/sw.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"demo
Get service worker JavaScript
Returns the service worker JavaScript code required for the demo page to handle push notifications. This script listens for push events and displays notifications to the user.
GET
/
demo
/
sw.js
Get service worker JavaScript
curl --request GET \
--url https://push.platform.arb.inc/demo/sw.jsimport requests
url = "https://push.platform.arb.inc/demo/sw.js"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://push.platform.arb.inc/demo/sw.js', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://push.platform.arb.inc/demo/sw.js",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://push.platform.arb.inc/demo/sw.js"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://push.platform.arb.inc/demo/sw.js")
.asString();require 'uri'
require 'net/http'
url = URI("https://push.platform.arb.inc/demo/sw.js")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"Response
200 - application/javascript
Service worker JavaScript code
The response is of type string.
⌘I