This may not seem like a development question but there is a link.
I have been experiencing some issues loading some web pages from my development machine. They were painfully slow. I disregarded this until I tried running my own site and found that the culprit was the show.ad.js file provided by google adsense.
Using firebug I see that the page hangs on the loading of this file and then aborts after about 5-10seconds. If I am calling multiple database records to a page it will load one, hang, abort and then load another.
Trouble shooting I have done and things I can rule out are:
My router or any other external peripheral. If I go to any other PC in the house the page loads fine and very quickly. I have tried cabled and wireless. The problem appears to be something unique with my machine.
It is not just my website, it is all websites with google adsense.
I have turned off my firewall and shutdown anti virus. No change.
It is from all browsers on this PC. I have tried chrome, safari, firefox and ie. No change.
I do not have any ad blocker software installed that I know about.
I know there could be a million reasons why I could be having this problem but I thought someone out there may have had a similar experience. Failing that, is there any way I can trace the problem as I have no idea where to start.
Thanks in advance
Put it as far down in the page as possible to minimize interference with rendering other elements.
I've worked on high volume sites where we would intermittently experience issues loading Google and other 3rd party js; we determined that the issue was with the 3rd party servers, not us; the only thing you can do (other than turning off adsense) is to organize the page so that it renders even if you can't load the 3rd party components.
Have you checked your hosts file? There may be a bogus IP address for the AdSense host defined there. This file is plain text and is located at %SystemRoot%\system32\drivers\etc\hosts on Windows boxes, with no extension. (%SystemRoot% is typically C:\WINDOWS on a default install.)
Also, there may be a bad IP address in your DNS cache. Run ipconfig /flushdns to clear it.
Related
for several days I'm struggling with putting ads to my personal website and since I'm already out of ideas I would like to ask you for help. Any idea or suggestion is highly welcome because I'm really desperate.
I got a short JS code from the ad network to put on my website. The code basically loads, dynamically creates iframe and loads ad content to this iframe from the ad company (more or less standard approach).
However in my case the iframe is created but the content is not loaded until I refresh the page one or more times.
The symptoms I identified are following:
it happens only on my site, ads from the same ad network work fine on different webs in the same browser
I'm able to reproduce the same behavior on different browsers, devices and operating systems = not local issue
the problem is not in my CMS (Wordpress)
To isolate the problem and make sure that the issue is not in any of Wordppress plugins or Wordpress itself I created simple test page on the same domain out of Wordpress:
https://www.beapple.pro/test.html
Just pure HTML, short text and the ad code. When you open this page the ad is not loaded on the first load, it must be refreshed.
I also found out that if I disable cross-domain tracking prevention in the browser (e.g. Safari) it works fine. However the ads from this network should work even if no cookie is set. And after several refreshes of the page it works as well no matter if the cookie is set or not. As I said ads from the same ad network work on different sites fine, therefore the dependency on cookies is probably not important. If the ad is finally displayed, it stays fine for some minutes and then it disappears again (probably cache).
I also tracked the HTTP request / response communication when the iframe is loaded. I found out that that the response contains empty HTML code if the ad is not displayed (at least this is what browser shows me in debug mode). The ad company told me that the request probably times out due to slow connection however I do not believe them since I verified the same behavior from different places and different connections.
The behavior is very strange and despite my effort I did not find root cause of the issue. If it happened only on my machine, I would say it is a local problem, if I had the same problem on all webs, I would say it is problem of the ad company. However it can be reproduced on any device (with blocking of 3rd party cookies enabled) but only on my domain.
Please help, you are my last resort. Thanks a lot for any input.
UPDATE: Any workaround is welcome as well. I did not figure out how to refresh the iframe reliably. Since I cannot access the inner html of the iframe due to browser security rules, it is hard to find out if there is any content or not = if refresh worked.
Apologies if this is a roundabout way of asking this question, but I am a little confused about how the web and javascript work.
What I want to do: execute javascript on all pages of a list of urls I have found. (Specifically use jquery to pull info from them)
Problem I can't execute Javascript on these pages because they aren't mine and don't have the Access-Control-Allow-Origin header. So I can't load them (with AJAX) in order to use JQuery on them.
BUT Google Chrome can both load pages and execute javascript on them (with their developer's console). So if I wanted too, I could go to each page, open the developers console, and pull the information from there. If there's nothing stopping Chrome from accessing these, then why am I stopped? And, is there a way around this?
Thank you, and I hope my description makes sense. I've been researching this for a while but have found nothing that explains how seemingly inconsistent CORS is.
I could go to each page, open the developers console, and pull the information from there. If there's nothing stopping Chrome from accessing these, then why am I stopped?
You're not stopped. You, the human at the keyboard, can do exactly as you say, by visiting each page as a top-level page.
What is stopped -- happily -- is any and all scripts on the Web you happen to run having the same level of visibility that you do. Based on your cookies and your network topology, you have a unique view into the Web. You can see your home router's control interface (on 192.168.1.1 or similar). You can see any local web server you're running on 127.0.0.1. No one else can see these. If the same-origin policy were not in place, then any script that you loaded on the Web could inspect these.
And, is there a way around this?
If you have some scripts that you trust absolutely (hopefully a significant subset of "all scripts that exist on the Web") that you want to be able to bypass the same-origin policy and see your full, cross-domain view of the Web, you could load them as an extension, which can act with elevated permissions beyond the abilities of normal web pages. (See How does Same Origin Policy apply to browser extensions?)
I'm going to assume that you are looking to grab data from these pages that aren't yours and store it somewhere. I have done this before with curl using php. If you are looking to display these sites for users to interact in a different way, but starting from a page that is yours, you may be able to render these pages by grabbing the source html using curl and rendering it as a sort of proxy.
I've used this tutorial for something similar https://www.youtube.com/watch?v=_kQN-3aNCeI . Hopefully this gives you a start. I think you should be a little more detailed in your question though to get more help.
The relevant line of the Google script is:
(window,document,'script','//www.google-analytics.com/analytics.js','ga');
I am running this particular file locally (as in, I double-click "index.html" on Windows Explorer and it opens in Chrome.
After about a minute of trying to load this file it fails with net::ERR_FILE_NOT_FOUND reported in the Developer Console.
I understand why this is happening, it is trying to load this as a local file. If I do this it works just fine:
(window,document,'script','www.google-analytics.com/analytics.js','ga');
In other words, I eliminated the //. This would work just as well:
(window,document,'script','http://www.google-analytics.com/analytics.js','ga');
Is going explicitly doing it this way to only track real websites?
If so, how are you dealing with this issue for local development?
I do run a VM with Ubuntu server for local development of more elaborate sites. In this case I was working on a single file landing page that I knocked out quickly and wanted to just test just as easily but ran into the browser hanging waiting for analytics.js
Is it safe to remove the // or add http: in general terms. I don't generally like to modify Google code unless I fully understand why they are doing things in a specific way and what the consequences of my actions might be.
Instead of viewing the file locally, run it through a local webserver. Two easy options are
XAMPP: http://portableapps.com/apps/development/xampp
Uniform Server: http://www.uniformserver.com/
Both require no installation. If you have Visual Studio or WebMatrix, you can also run it through Cassini or IISExpress.
It can be that you are using a VPN(Virtual private network) which analytics blocks. Try loading https://www.google-analytics.com/analytics.js
If id does not work try disabling the VPN and try again.
Or as someone else mentioned it could be that your AdBlock is blocking it.
I found the some strange <script/> tags on a site:
<script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/document_iterator.js"></script>
<script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/find_proxy.js"></script>
...
I haven't been able to find much information on this, but I highly doubt this is actually related to Google Chrome since this site in particular is still using <table>s for layout, and the source in question was retrieved with curl not a graphical web browser.
So,
What on earth is this?
What is chrome-extension://
Why is it using lifbcibllhkdhoafpjfnlhfpfgnpldfl as a directory name
Why is it pretending to be valid URL to a javascript file?
Why would I need find_proxy or document_iterator
Solved. As far as I know...
chrixian was right, It seems that only on this and a few select other pages, someone had re-saved them from Chrome's source-view with the Skype extension installed.
Thanks everyone for all your help, +1's for all! enjoy!
That is actually Skype Click to Call chrome extension.
Manage and view it using this link
chrome://extensions/?id=lifbcibllhkdhoafpjfnlhfpfgnpldfl
If you are using cURL to get the page, you're getting the HTML as it exists on the server--so I think a safe assumption would be: the author of the page initially saved the page from Chrome, he had an extension installed that inserted these script tages and lastly he didn't remove the script tags for one reason or another before putting the page on the server.
This is added by chrome as the page loads, to inject the extension's Javascript code into the page, so it can access the HTML document.
The Skype extension causes it by inserting all kinds of junk in webpages that you visit.
Do you have the Skype browser extension installed for Chrome?
Just disable the extension.
Chrome, like Firefox, provides developers with an easy API to extend the functionality of the web browser without needing to actually download and build the browser to do so.
They also provide a robust delivery system. In Google's case, it's the Google Chrome Web Store.
Extensions are installed locally on your computer, and use long strings as directory names to reduce the risk of collisions with another extension. In other words, if you and I both named our extensions "mycoolextension", then there would be a problem if a person tried to install your extension and my extension. The long string helps prevent collisions such as this.
The chrome-extension:// protocol is used by the browser to make requests to these local resources. Chrome extensions are developed using HTML5, JavaScript, and CSS, along with an API exposed to allow the local JavaScript to perform actions it would not normally be able to do on the Internet.
When you see these in the Chrome developer tools, it's just the extension doing it's thing, whatever that may be.
If you're seeing these, then you likely installed some extensions from the Chrome Web Store. To view them, go to the Tools menu and select "Extensions". This will show you a list of all installed Chrome extensions and apps.
To learn more about extension development, see the Getting Started Tutorial.
Also, as someone else mentioned, you're using the Skype Call Extension. However, an app using that directory name doesn't appear in the first page of the search results. It might be worth doing some more research to make sure you got that extension from a legitimate source, whether that be Skype or the Chrome Web Store.
If you're seeing it in Chrome developer tools for every request you make, it means it has access to all your websites, which could be benign, like if they're just making phone numbers clickable, or it could be malicious, if it's scraping your bank account info and shipping it off to some third party server. :)
It's a Chrome extension, and chrome-extension:// is a URL for extensions to address their contents via Javascript.
lifbcibllhkdhoafpjfnlhfpfgnpldfl is the unique identifier for the extension. I can't find it with a search, but apparently it might be Skype.
It's not pretending... it is a valid URL. The Javascript file is located in the extension. If you were to look on your harddrive you'd probably find that very file in the extensions folder.
The functions its calling probably are some sort of detection used by the extension to see if it needs to enable itself.
See this for some additional information:
Checking if user has a certain extension installed
For creating an offline version of a bunch of linked web pages I use an app.manifest-file that lists all the web pages for offline caching.
I would like it that the app.manifest file is not fetched every time when a user jumps from one web page to another. Most of the web pages will never be updated once the application is on the iPhone. Also the target audience is abroad so roaming costs could add up while users are using my "web app".
Searching the internet made me think in the direction of forcing an offline mode in Mobile Safari using Javascript but I don't know if this is the right way to go or if it is even possible.
Does anyone have any other and/or better ideas and suggestions on how to do this?
I would try setting an expires header to the future for the manifest file. That should theoretically prevent the browser from making a request for it. Never tried it, though.