connect.sid not generated in Bluemix - javascript

We have some JavaScript lines working fine on local node.js (and Mongo.db).
But when we moved the code to BlueMix, something does not work.
Let me explain.
I see in the chrome browser there is a cookie named "connect.sid" when all is ok (local server).
And "connect.sid" is not present when code runs in Bluemix, so I can not use "request.session".
Any clues ?

One probable reason could be that due to httpOnly flag is being set. pls. do check on this.

Related

Html5 audio tag not working in Local IIS for Google translate_tts

Trying to use google's translate_tts as my fallback if the browser doesn't support speechSynthesis for my project.
Now I am having some trouble with getting the html5 audio working properly.
Been scratching my head and googling all day on why it wasn't working for me.
Then I came across some articles/forums saying that it's something to do with IIS. So I did a test code outside my site to see what happens, and was surprised this worked properly! But when using the same code in my original project which is running in IIS it doesn't work. AND it works when using IIS EXPRESS. I check the MIME types in IIS and mpeg and mp3 are there.
Even doing it in javascript doesn't work in IIS.
TextToSpeech.Audio = document.createElement("AUDIO");
TextToSpeech.Audio.src = url;
TextToSpeech.Audio.playbackRate = 1;
TextToSpeech.Audio.preload = 'auto';
TextToSpeech.Audio.volume = 1; // 0 to 1;
TextToSpeech.Audio.addEventListener('ended', function () {
//i have some code here...
});
TextToSpeech.Audio.addEventListener('error', function (error) { });
TextToSpeech.Audio.play();
Has anyone encountered this issue and happened to resolve it? Your help will be much appreciated, Thanks!
UPDATE: After some more googling, this might be because I am calling it from within my site hosted in IIS which has a proper hostname and my IIS Express runs the site in localhost:PORT which Google sees as noreferrer?
starting some time in the last few days, google seems to have placed a 'captcha' on this service and made it so that it can no longer be called by a server. so this may all be moot.
it used to be you could ONLY call it as a noreferrer, so i don't think noreferrer is your issue (or may be the least of your issues starting a few days back). one way to workaround the issue in fact was to add ref='noreferrer' to your link.
and this may be your initial issue: using wget, you had to use the -U Mozilla option which makes wget appear to be a browser. if you called the url without that, it didn't return anything. so if there is a way to make your IIS look like a browser when calling the google url, that may work.
this link google text-to-speech artile still does work in a browser, maybe that will help you use it the way you want.
however... starting july 28th, i get a '503 service not available' after using it for years with wget on my linux server. could be because it's metered and i've overrused it... i hope it comes back on. i only use it about 100x/day.
they always said it was 'not public' but it is widely used that way...
so that could be related if you're still trying to call it from IIS which i would think behaves similarly to calling it from a linux server.

What is the cookie path if I am using XAMPP?

I am trying to find the cookie that I created using Google Chrome and on the XAMPP server. I am using the Cookies.js plugin. I know the cookie is being created successfully because my website loads up the settings that I write into the cookie, but I can't find it in htdocs which I believe is the root folder. The cookie path is the default (root) path.
So after a bit of poking around, I finally found the cookie.
In Chrome, it's stored in either of the two paths below:
C:\Users\your username\AppData\Local\Google\Chrome\User Data\Default
C:\Users\your username\AppData\Local\Google\Chrome\User Data\Default\Local Storage
answer is here: https://superuser.com/questions/459426/where-does-chrome-store-its-cookie-file
or it can be accessed by typing the following in the URL bar
chrome://settings/cookies
In Firefox, it can be accessed at
C:\Users\user\AppData\Local\Mozilla\Firefox\Profiles\random characters
answer is also here: https://superuser.com/questions/387372/where-does-firefox-keep-cookies
I checked the paths myself so I am pretty sure that they are right. Correct me if I am wrong. I also noticed that the paths change between some versions of the same browser so beware of that too.
Cookies are not created in /htdocs folder, they are being held only in browser. For more information check
http://www.allaboutcookies.org/

Recover javascript logs and errors on Internet Explorer without F12 tool

The main idea is to run a random page on Internet Explorer and get javascript errors and logs.
Is there a way to recover javascript console logs and execution error
from a random web page without accessing the F12 tool on Internet
Explorer?
I found that with Chrome based browser, you can get it on your AppData file log by adding --enable-logging --v=1 args when launching.
Any solution with any language are welcome.
Thank you for your answer.
NOTE :
random page on Internet Explorer means that I do not have the access on the source code.
Basic solution to this would be:
1. Use Exception Handling to catch the errors.
2. Log errors in a Global Array
3. Log the errors in a file using Blob and URL.createObjectURL. All recent browsers support this.
Have you considered using a Bookmarklet that:
Overrides window.console.log and window.console.error (to intercept messages)
Logs incoming messages somewhere using createObjectURL?
Or you could use something like firebuglite and auto-enable it like this:
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js">
{
overrideConsole: false,
startInNewWindow: true,
startOpened: true,
enableTrace: true
}
</script>
More instructions are here: http://getfirebug.com/firebuglite
If the F12 tool is not of your interest, then what about the Event Viewer? Open Event Viewer from Control Panel -> System and Security -> Administrative Tools -> Event Viewer.‌ Then select the log Applications and Services Logs\Internet Explorer.
By default no events are being logged for Internet Explorer, to enable them create a new DWORD registry value named Feature_Enable_Compat_Logging under the following registry key:
HKCU\SOFTWARE\Microsoft\Windows\Internet Explorer\Main \FeatureControl
and set the registry value to 1.
Check the logs you get to see if it's what you're looking for.
One idea would be to write a browser extension which listens for window.onerror and writes to a file. Definitely not as elegant as the Chrome solution, but it would work fairly well.
Using local proxy might be a good one-time solution.
Charles web debugging proxy app has nice UI and it allows to replace any response with local resource.
So basically you'll need:
Download one any of the js files used on target page
add any code you wish to saved version
set up Charles to serve you your local version instead of remote one
You might try Fiddler. It's got its own logging and has amazing inspection power. It won't capture IE specific errors, since it's at a different layer, but it will definitely get you any code that's coming over the wire.

web workers not working in firefox 8, works in firefox 7

I am using library called arbor.js(beautified). It contains the following line of code,
i = new Worker(<path to arbor.js>);
At this point an error is thrown, and the following message is reported in Firebug,
"Could not get domain!"
The line which gives this error is 258. The arbor_path() function on that line returns "js/", so effectively function called is i = new Worker("js/arbor.js").
This used to work perfectly in Firefox 7. Does anybody know how to solve it, or what the problem could be?
You're running into https://bugzilla.mozilla.org/show_bug.cgi?id=683280
It'll be fixed in Firefox 9 in about a month....
I came across the same thing, however I only noticed the problem on one of my computers, and not the other (both running Firefox 8), so I started to explore a little bit. It turns out, the computer the workers were working on is using a subdomain of localhost (and modified HOSTS file). I just tested it out as simply as I could think of, just adding localhost.com to the HOSTS file, and accessing the site through that and the workers are doing ok with it. I didn't create any virtual hosts or directories, just mapped localhost.com to 127.0.0.1. If you are running on Windows (or otherwise can do the same kind of mapping) you might want to give that a try as a temporary solution.
Edit: In response to chinmayv's comment: Something I noticed I have set in the HOSTS file is the IPv6 version of the local IP address, so there is both: ::1 localhost and 127.0.0.1 localhost, as well as the one to get the worker running on FF8 127.0.0.1 localhost.com. I don't know why this would matter, however. I just did a fresh install of Apache, so I don't think there is any setting that could account for the difference in behavior. Are you still getting the 'Could not get domain!' error? Maybe there is an absolute URL in the script somewhere that is throwing it off?

Uncaught Error: SECURITY_ERR: DOM Exception 18 when I try to set a cookie

I get the following error in Chrome's developer tools window when I try to set a cookie using this jQuery plugin:
Uncaught Error: SECURITY_ERR: DOM Exception 18
What does this error mean and how can I fix it? I get the same error when I use this jQuery plugin.
You're most likely using this on a local file over the file:// URI scheme, which cannot have cookies set. Put it on a local server so you can use http://localhost.
I also had this issue while developping on HTML5 in local.
I had issues with images and getImageData function.
Finally, I discovered one can launch chrome with the --allow-file-access-from-file command switch, that get rid of this protection security.
The only thing is that it makes your browser less safe, and you can't have one chrome instance with the flag on and another without the flag.
You can also "fix" this by replacing the image with its inline Base64 representation:
img.src= "data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw==";
Useful, when you do not intend to publish the page on the web, but instead use it on local machines only.
Faced with the same situation playing with Javascript webworkers. Unfortunately Chrome doesn't allow to access javascript workers stored in a local file.
One kind of workaround below using a local storage is to running Chrome with --allow-file-access-from-files (with s at the end), but only one instance of Chrome is allowed, which is not too convenient for me. For this reason i'm using Chrome Canary, with file access allowed.
BTW in Firefox there is no such an issue.
This error pops up, if you try to create a web worker with data URI scheme.
var w = new Worker('data:text/javascript;charset=utf-8,onmessage%20%3D%20function()%20%7B%20postMessage(%22pong%22)%3B%20%7D'); w.postMessage('ping');
It's not allowed according to the standard: http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#dom-worker
I had this issue when using the history API.
window.history.pushState(null, null, URL);
Even with a local server (localhost), you want to add 'http://' to your URL so that you have something similar to:
http://localhost...
I wasn't completely happy by the --allow-file-access-from-files solution, because I'm using Chrome as my primary browser, and wasn't really happy with this breach I was opening.
Now I'm using Canary ( the chrome beta version ) for my development with the flag on.
And the mere Chrome version for my real blogging : the two browser don't share the flag !
One can also receive this error if using the new (so far webkit only) notification feature before getting permission.
First run:
<!-- Get permission -->
<button onclick="webkitNotifications.requestPermission();">Enable Notifications</button>
Later run:
// Display Notification:
window.webkitNotifications.createNotification('image', 'Title', 'Body').show();
The request permission functions needs to be triggered from an event caused by the user, otherwise it won't be displayed.
I was been getting that error in mobile safari when using ASP.NET MVC to return a FileResult with the overload that returns a file with a different file name than the original. So,
return File(returnFilePath, contentType, fileName);
would give the error in mobile safari, where as
return File(returnFilePath, contentType);
would not.
I don't even remember why I thought what I was doing was a good idea. Trying to be clever I guess.

Categories