URL from attached documents not opening correctly

USING API TO CREATE WP SITE.
Hi all. So I have rows of data and a column in the row is Attachments. It is just as it sounds, an uploaded document.

My code to generate the URL into content on the page is:
f=String(record.get(“Application Name”));
l=record.get(“Attachments”);
container+="<a href=’"+l[0][‘url’]+"’ target=’_blank’>"+f+"";

The resulting URL is below:
Aviation Workers Comp Instructions
When this URL appears out on the page and I click on it, I get an error that says
http://dnserrorassist.att.net/search/?q=http%3A//ar.ecologik.netnull/&r=http%3A//ar.ecologik.net/applications/&bc=
NOW, if I right mouse click on any of the links and have it open in a new window the docs load just fine. I notice that there is a null being thrown in the error message. Where is that coming from? I am at a lost on this one!

Well, I notice when I click on the link in my post it works. Is this a cross scripting issue in that my test site is not https?

There are reasons this [may] work with a right click, but I believe that is accidental and likely related to the way browsers attempt to sanitize incorrect URL references.

If you look at this code fragment, something is not right about it and the missing closing anchor tag may be part of the problem.

<a href=’" + l[0][‘url’] + "’ target=’_blank’>" + f + "";

I recommend you share three things:

  1. The actual URL you see in the lower bar in the browser when you hover over the link.
  2. The actual URL by right-clicking and copying the URL.
  3. The actual HTML code for the entire part of the web page where the URL is rendered.

Probably not. This is likely because this community platform is sanitizing the URL and attempting to correct it – OR – it is your browser doing the lifting to unencode the URL for rendering.

Creation Code
container+="<a href=’"+l[0][‘url’]+"’ target=’_blank’>"+f+"";
Hover Over URL:


Actual Code:

  • Fixed Base Operations - GL
  • Thanks Bill.

    Was going to post the website but my API is exposed until I server side parameter the thing at launch. Bill if you have an email I could send you the site that way if you think seeing might help.

    @Jon_Eynon,

    Your HTML code is wrong if what you’re showing me is the complete code that renders the link.

    It is missing the closing anchor tag.

    This is not the actual HTML code because the community platform is allowing the browser to interpret the HTML you are pasting. You need to paste an image of the actual code for me to see it.

    image

    Try this -

    1. Display the page;
    2. View the source;
    3. Find the place where this link is rendered;
    4. Take a screenshot of that area of the code from at least the beginning to end of the anchor tag.

    Thanks again.

    Thanks for pasting that image - it appears your code pulling from Airtable; the fields from the attachment collection are fine, and the HTML generated is fine as is the URL to the document.

    That leaves us with only one more place to focus attention - your DNS.

    Notice the error in this earlier posting - it references a DNS error server suggesting that the server hosting this page may not actually be able to resolve the Airtable URL for that document. Or… requests to https://ar.ecologik.net/ are somehow being redirected or refused in some circumstances. And quite possibly hinting at your original concern…

    But, without a lot more diving and access to all the machinery and a way to work within your network, it’s difficult to say what is causing clicks to fail and clicks into a new tab to succeed.

    One thing is clear though - your integration and HTML code appears to be just fine.

    I have since put the test server in an https environment and the results are the same.

    Why does AirTable put the dot in the middle of domain? Do you think that might have something to do with it? It can’t resolve the domain because it interprets that dot as the end?

    The issue was in some local javascript that was causing a null to get applied at the end of the url. It was carry over code from another page. Links were just fine and AirTable acting as it should. Thanks for helping troubleshoot. Case closed

    This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.