Start a new topic

Resources will not load when the content URL contains a # hash (fragment)

Hello,


API's such as AR.TargetCollectionResource, AR.ImageResource, ...etc will not correctly load resources when the URL of the main content contains a # hash (fragment)


For example, if my AR content is located at 

https://somehost/somepath/index.html#anchor


and I have resources at

https://somehost/somepath/assets/magazine.wtc

and

https://somehost/somepath/assets/imageOne.png


calling

 AR.TargetCollectionResource("assets/magazine.wtc", {});

AR.ImageResource("assets/imageOne.png");


will result in sending http requests like...

https://somehost/somepath/index.html/assets/magazine.wtc

https://somehost/somepath/index.html/assets/imageOne.png

to the server.


and thus result in 404 not found response.


I'm using Javascript SDK version 7.2.1.  This problem can be verified by placing an AR content on a server and designate the URL (with hash) using the "Manage URSs" -> "Custom URL's" in the SDKExample app.


line 166-170 in architect.js 

    var b = document.baseURI.substring(0, document.baseURI.indexOf("/") + 2),
        c = document.baseURI.substring(document.baseURI.indexOf("/") + 2);
    c.indexOf("#") > 0 && c.length > c.indexOf("#") + 1 && (c = c.substring(0, c.lastIndexOf("#")), "/" !== c[c.length - 1] && (c += "/")), c = c.substring(0, c.lastIndexOf("/") + 1);
    var d = b + c;
    return "/" !== d[d.length - 1] && (d += "/"), "/" === a[0] && (d = d.substring(0, d.indexOf("/", d.indexOf("//") + 2))), d + a

 is not returning proper URL.


Hello,


thank you for reporting this issue and providing a thorough explanation.

We could already fix this issue and it will be included in the next release. Please checkout the next beta version of the JS SDK, which we plan on releasing this week, to verify if this fixed the issue for you.


Best Regards,

Alex

Thank you Alex... I'll wait to see the next beta release...

Login or Signup to post a comment