<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic featureservice can not be displayed using javascript hosted locally in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/featureservice-can-not-be-displayed-using/m-p/1576718#M7402</link>
    <description>&lt;P&gt;I am trying to do an example here : &lt;A title="intro layer" href="http://intro%20layers" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/intro-layers/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I replace these parts:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.31/esri/themes/light/main.css" /&amp;gt;
&amp;lt;script src="https://js.arcgis.com/4.31/"&amp;gt;&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;with my own hosted js on my laptop using XAMPP:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;link rel="stylesheet" href="http://localhost/javascript/api/4.31/esri/themes/light/main.css" /&amp;gt;
&amp;lt;script src="http://localhost/javascript/api/4.31/"&amp;gt;&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Note: the locally hosted JS scripts are on "http", not "https"&lt;/P&gt;&lt;P&gt;I add my own layer hosted on Geoportal on our company web server on this part&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"const featureLayer = new FeatureLayer({" :&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;so it becomes like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const featureLayer = new FeatureLayer({
url: "https://companywebserver.com/server/rest/services/Survey/Boundary/FeatureServer/0"
});&lt;/LI-CODE&gt;&lt;P&gt;This web server can be accessed from outside.&lt;/P&gt;&lt;P&gt;All links hosted on localhost (script and feature service) work correctly and can be accessed. They give out the same&amp;nbsp;output as the script hosted on arcgis.com&lt;/P&gt;&lt;P&gt;The apps &lt;STRONG&gt;works without problem if I use the script hosted on "js.arcgis.com"&lt;/STRONG&gt;. The FeatureService is loaded successfully. There is&amp;nbsp;popup window requesting login to the Portal item (feature service). This is because I dont use token I guess, but its fine.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But, It &lt;STRONG&gt;does not work using locally hosted JS&lt;/STRONG&gt;. Here are the errors:&lt;/P&gt;&lt;P&gt;1). Uncaught SyntaxError: Unexpected token '&amp;lt;' (at VM709:1:1)&lt;BR /&gt;2). (index):1 Uncaught SyntaxError: Unexpected token '&amp;lt;' (at (index):1:1)&lt;BR /&gt;3). There is info on AutoClicker.JS saying "AutoClicker initilize complete"&lt;BR /&gt;Note: Both errors 1 &amp;amp; 2 point to "&amp;lt;!DOCTYPE html&amp;gt;"&lt;/P&gt;&lt;P&gt;Here is the screenshot about the error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yockee_0-1737086120566.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123528i0E36AD5DF0A65FDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yockee_0-1737086120566.png" alt="yockee_0-1737086120566.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, to avoid those errors above, I add "type="text/JSX"" to the script tag. They now become:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.31/esri/themes/light/main.css" type="text/JSX"/&amp;gt;
&amp;lt;script src="https://js.arcgis.com/4.31/" type="text/JSX"&amp;gt;&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;The first 2 errors do not appear. The warning about autoclicker still persist. But there is nothing on the display. It is just a blank white display.&lt;/P&gt;&lt;P&gt;The only difference between using JS hosted locally and hosted on arcgis.com is&lt;BR /&gt;the login popup to the Feature Service hosted on local Geoportal.&lt;/P&gt;&lt;P&gt;What seems to be the problems ? How can I fix this ?&lt;/P&gt;&lt;P&gt;Many thanks. Need some advice.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jan 2025 03:58:46 GMT</pubDate>
    <dc:creator>yockee</dc:creator>
    <dc:date>2025-01-17T03:58:46Z</dc:date>
    <item>
      <title>featureservice can not be displayed using javascript hosted locally</title>
      <link>https://community.esri.com/t5/developers-questions/featureservice-can-not-be-displayed-using/m-p/1576718#M7402</link>
      <description>&lt;P&gt;I am trying to do an example here : &lt;A title="intro layer" href="http://intro%20layers" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/intro-layers/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I replace these parts:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.31/esri/themes/light/main.css" /&amp;gt;
&amp;lt;script src="https://js.arcgis.com/4.31/"&amp;gt;&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;with my own hosted js on my laptop using XAMPP:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;link rel="stylesheet" href="http://localhost/javascript/api/4.31/esri/themes/light/main.css" /&amp;gt;
&amp;lt;script src="http://localhost/javascript/api/4.31/"&amp;gt;&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Note: the locally hosted JS scripts are on "http", not "https"&lt;/P&gt;&lt;P&gt;I add my own layer hosted on Geoportal on our company web server on this part&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"const featureLayer = new FeatureLayer({" :&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;so it becomes like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const featureLayer = new FeatureLayer({
url: "https://companywebserver.com/server/rest/services/Survey/Boundary/FeatureServer/0"
});&lt;/LI-CODE&gt;&lt;P&gt;This web server can be accessed from outside.&lt;/P&gt;&lt;P&gt;All links hosted on localhost (script and feature service) work correctly and can be accessed. They give out the same&amp;nbsp;output as the script hosted on arcgis.com&lt;/P&gt;&lt;P&gt;The apps &lt;STRONG&gt;works without problem if I use the script hosted on "js.arcgis.com"&lt;/STRONG&gt;. The FeatureService is loaded successfully. There is&amp;nbsp;popup window requesting login to the Portal item (feature service). This is because I dont use token I guess, but its fine.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But, It &lt;STRONG&gt;does not work using locally hosted JS&lt;/STRONG&gt;. Here are the errors:&lt;/P&gt;&lt;P&gt;1). Uncaught SyntaxError: Unexpected token '&amp;lt;' (at VM709:1:1)&lt;BR /&gt;2). (index):1 Uncaught SyntaxError: Unexpected token '&amp;lt;' (at (index):1:1)&lt;BR /&gt;3). There is info on AutoClicker.JS saying "AutoClicker initilize complete"&lt;BR /&gt;Note: Both errors 1 &amp;amp; 2 point to "&amp;lt;!DOCTYPE html&amp;gt;"&lt;/P&gt;&lt;P&gt;Here is the screenshot about the error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yockee_0-1737086120566.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123528i0E36AD5DF0A65FDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yockee_0-1737086120566.png" alt="yockee_0-1737086120566.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, to avoid those errors above, I add "type="text/JSX"" to the script tag. They now become:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.31/esri/themes/light/main.css" type="text/JSX"/&amp;gt;
&amp;lt;script src="https://js.arcgis.com/4.31/" type="text/JSX"&amp;gt;&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;The first 2 errors do not appear. The warning about autoclicker still persist. But there is nothing on the display. It is just a blank white display.&lt;/P&gt;&lt;P&gt;The only difference between using JS hosted locally and hosted on arcgis.com is&lt;BR /&gt;the login popup to the Feature Service hosted on local Geoportal.&lt;/P&gt;&lt;P&gt;What seems to be the problems ? How can I fix this ?&lt;/P&gt;&lt;P&gt;Many thanks. Need some advice.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 03:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/featureservice-can-not-be-displayed-using/m-p/1576718#M7402</guid>
      <dc:creator>yockee</dc:creator>
      <dc:date>2025-01-17T03:58:46Z</dc:date>
    </item>
  </channel>
</rss>

