Unexpected Token ILLEGAL only in Chrome, only on Refresh - facebook

Help me Stack Over-flow-nobi, you're my only hope.
I see lots of posts and questions about the 'Unexpected Token ILLEGAL' issue in chrome, but haven't found a solution for my own variety of the problem.
I'm building a Facebook tab that needs to be served https (Facebook policy). It's a page built in WordPress and I'm using the WordPress HTTPS plugin to force my particular page to render with HTTPS.
When I test with regular old HTTP, everything is fine (except for the "unsecure content" warnings, but that's another issue).
When I test with HTTPS, when the page loads the first time, it's okay, but if I hit REFRESH, then I get the ILLEGAL error. It's inconsistent - sometimes it balks on a different file, but something bad happens almost every time.
The page is at http://www.facebook.com/pages/TbkCreative-Leavens-VW-Beta/178151292291863?sk=app_363900450303117
screen shot of error on Chrome console http://tbkcreative.com/sandbox/leavens/files/2012/01/unexpected_token.png
Any insight? I'm banging my head against the wall on this one.
Thanks
Trevor

File this one under the red herrings and wild goose chases.
I'm using a plugin called GD Star Rating on this app. It includes a dynamic CSS file. It was being loaded in with:
<link rel='stylesheet' id='gdsr_style_main-css' href='https://tbkcreative.com/sandbox/leavens/wp-content/plugins/gd-star-rating/css/gdsr.css.php?t=1327595625&s=a10i10m20k20c05r05%23121620243046%23121620243240%23s1pchristmas%23s1pcrystal%23s1pdarkness%23s1poxygen%23s1goxygen_gif%23s1pplain%23s1ppumpkin%23s1psoft%23s1pstarrating%23s1pstarscape%23t1pclassical%23t1pstarrating%23t1gstarrating_gif%23lsgflower&o=off&ver=1.9.10' type='text/css' media='all' />
If I got rid of all of those query arguments, the problem went away. Ditto for if I just got rid of the file altogether. I didn't dig deeper to figure out exactly what was causing the issue, as I was just relieved to figure it out.
I don't understand why this file was causing javascript files down the pipe to be loaded incorrectly. I don't understand why it only happened in Chrome, accessing the page with HTTPS and when I hit refresh. Weird.
But fixed.

Related

ModalPopupExtender doesn't show on some computers

I maintain a vb.net website. A button on a page shows an AjaxControlToolkit.dll ModalPopupExtender. When I click the button, the page reloads, but no popup appears.
My tests below cover the scenarios I can think of. Please help me diagnose and fix.
This ModalPopupExtender succeeded in the past. The error might have started when we moved to a new server, or when we implemented https, or a browser update, or at some other time since then.
Tried Chrome (latest) and Firefox.
I RDPed into the server and opened the page in Chrome there. ModalPopupExtender succeeded. Same Chrome version as my PC. So, unlikely to be a code issue.
A different page on the same site uses ModalPopupExtender successfully. So, unlikely to be local PC settings.
I put lines of test code immediately before and after ModalPopupExtender.Show(). Both succeed.
Aha - found it!
Solution
The ASPX/HTML referred to http://ajax.googleapis.com. Changing the references to https made ModalPopupExtender.Show() work correctly for me.
Explanation/Diagnosis (if you can clarify further, please comment)
When I checked the html served to my browser, I noticed it defined a javascript function called fn(). The definition for fn() didn't appear in the html served to the server's browser. After the https change, fn() no longer appears in the html I receive. The other page, where ModalPopupExtender worked, didn't have any reference to googleapis.com.
I assume that using http instead of https caused ajax.googleapis.com to provide fn() and that fn() in some way interfered with the normal operation of my ModalPopupExtender.
Here's the fn() definition: (function {var fn = function() {Sys.Extended.UI.ModalPopupBehavior.invokeViaServer('ctl00_cphContent_ModalPopupExtenderConfirm', true); Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();
Note: the http also included another javascript function related to the ModalPopupExtender. But there was a similar one on the working page, and in the working version served to the server's browser, and in my fixed version. So, I assume that function is correct.

Privoxy whitelist faulty on redirect

My problem, in a nutshell, is the following:
I use Privoxy to set up a whitelist of sites in Raspbian Jessie on Chromium. I have Chromium start on boot with the following snippet in lxsession/LXDE-pi/autostart:
#privoxy
#chromium --incognito --kiosk --proxy-server=127.0.0.1:8118
This does work as intended, with every site except the ones I specify blacklisted.
Now I edited /privoxy/templates/blocked so that instead of the usual site it will give me a redirect to a certain site should a link be opened that is not on the whitelist:
<!DOCTYPE html>
(Stuff happens)
Please go back to this site.
example.com being one of the sites I whitelisted. The problem is, it simply redirects me to the "blocked" page again, making me stuck in a loop. Does anyone have a clue why this would be and how I could work around it? I tried using
window.history.back()
however it doesn't seem to work either.
I use Kiosk mode because I want to use this in a context where entereing URL-adresses is not desired, just to clarify my Chromium-call.
Well, I solved it, at least partially. Turns out that I need to add http:// in front of the URL, since it gets added to the already existing URL otherwise. Which is fair, but a bit awkward for me to admit. HTML isn't exactly my forté. Marking it as solved and keeping it, just in case somebody stumbles upon a similar problem.

window.CavalryLogger error in Facebook App running in Facebook Page Tab

I have applications which are displayed as tabs in Facebook pages which have been working fine. They suddenly started displaying this output in the tab:
/1336720089,176820405/
if (window.CavalryLogger) { CavalryLogger.start_js(["EgxV3"]); }
__d("UFIUpdate",
Any ideas what is going on???
Here is a link to one of them: http://www.facebook.com/TweakShoes/app_132692060112327
A temporary solution is to add https:// to facebook itself. This doesn't solve the problem, but it'll allow you to see your page on a per client basis.
The best fix in the longer term until facebook fixes this issue is to go to your account settings > Security > Enable secure browsing. This will enforce HTTPS wherever it can and should resolve the issue for a lot of pages you're trying to access.
Good Luck!
After encountering this issue yesterday, I tracked it down to an apparent conflict with the JS log wrapper included as part of HTML5 Boilerplate's script.js file. In particular, the "make it safe to use console.log always" snippet. After commenting it out, the FB lib error went away and my app displayed properly.
I didn't dig into what the conflict was, but here is the snippet. If you use something similar on your page, then it may be worth investigating.
/* make it safe to use console.log always */
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
{console.log();return window.console;}catch(err){return window.console={};}})());
It's probably not a coincidence that FB's own logger bugs out with this.
Facebook has opened a bug for this issue and recently triaged it to medium priority - no word on when it will be addressed.

GWT - spring security - caching issue

I have a GWT application which is secured by Spring Security. I have a Main.html which serves the application and Login.html for login. For most part everything works fine everytime. But sometimes after restarting my application I can still access Main.html - although most of the widgets on the page are unusable. I can see the Login.html's HTML in the console being printed as exception. On refreshing, it takes me to login page. Has anyone ran into similar issue? Is this some kind of caching issue? How can this be avoided?
It seems that in your case your bootstrap file is beining cached and thus a wrong version of your app is being loaded.
You have to make sure that your bootstrap file (the one which is named nocache) is never cached. See here for more details.
You can check if your bootstrap file is cached by using Firebug and looking at the HTTP requests for your scripts. You can check two things:
If the correct <md5>.cache.html are loaded (compare it to the ones in your gwt output folder).
The response type of your .nocache. file is not 304 or so.
Adding meta tag on top of my Main.html - helped me resolve my issue for now.
Read this for more details : HTML http-equiv Attribute

Apps>Menu>Basic 405 Method Not Allowed

I am hosting my pages on my doamain. I put the following info. When I go to view the app it shows 405 Method Not Allowed..Not sure what I am doing wrong.
*
The first page load a APP makes is a POST request.
Seems your server could be rejecting them.
Its worth checking the server side error log for further information.
Indeed, it will most probably be a setting on your server. I had the same problem, my server didn't allow POST method on .html pages, changed my canvas page source to .php and all works fine now.
If you can look at your apache logs, it will provide a more clear error that we can help you debug with. Though a 405 error typically signifies a problem with the server and usually stems for a POST request.
I have made the mistake 2 times of creating my site in html instead of using a scripting extension. For example, if you are running on a Windows server and coding in Visual Studio, it is tempting to just create .htm or .html files. However, most web servers will not allow a POST operation to these pages. Instead, create .aspx pages, which will still allow you to use the same exact static HTML and JavaScript. This solved my problem in both cases.