Javascript javascript not displaying correctly in browser if called directly?

I hope this is the right place to ask this question - I looked at the rest of the sites on the net, but it looked like the most suitable place.

We are having problems servicing third-party ads on our sites. For various reasons, our installation of ads is a bit complicated - we serve third-party javascript tags (AppNexus) through our own ad server (OpenX) through iframes. Currently, third-party javascript tags do not display correctly, although in the past they worked just fine.

Debugging this in Safari. I found a few things that seem a little unusual to me, and I'm struggling to figure out what is going on. Using the web inspector to validate third-party javascript, it appears in the web inspector as an empty file. In addition, if I check the tab on the network, the headers are displayed and look normal, but there is no โ€œcontentโ€ tab with which you can check the returned content. The Network tab shows the request for the file as complete and with the corresponding status codes (200/302):

http://cl.ly/401C1D3Y3u2G2k2k3s0x

However, if I upload the file directly to a web browser, it loads fine:

http://ib.adnxs.com/ttj?id=694021&cb= [CACHEBUSTER] & pubclick = [INSERT_CLICK_TAG]

FWIW, a javascript file uses document.write to splash out an image or other iframe. It is also worth mentioning that there are no related errors in the console. One of them concerns Google ads, but the problem persists if I download the iframe of the ad server directly without the rest of the site.

Has anyone seen this behavior before when a file is downloaded only fine directly, but (empty / not extracted / not parsed / whatever) when it is called as part of another page? If so, can you help me fix this?

Thank you in advance for any help you can give me - I hope this makes sense and will be happy to provide any additional information that could help me sort this out!

Ollie

+4
source share
1 answer

I assume that a third-party site filters the output of its servers based on the HTTP referrer sent in the request (a method used by many web hosts to prevent hot linking). Try placing the link to the javascript file in the interactive link on the web page of your server and click on it, and then see if it loads or if you get a blank page. You can also try downloading a browser extension that allows you to fake an HTTP link (for example, RefControl for Firefox), and then change your indication of your site instead of a third party and try pasting the URL into your browser and see if it loads.

It is not your fault if this is what turns out to be a real problem. In order for a third party to set up their web hosting, a third party is allowed to do this.

0
source

Source: https://habr.com/ru/post/1388991/


All Articles