angularjs looking for files on localhost after grunt-distribution - ajax

i'm working on a project with angular and grunt. before "grunting" angular reads the local files, but after "grunting" my index.html-file doesn't show anything. the tool "console" in chrome show me this error message:
"XMLHttpRequest cannot load file:///Users/userxx/Dropbox/Produktion/_resources/workspaces/userxx.html5/taleshipkiosk/_temp/repository/taleshipkiosk/dist/views/kiosk.html. Origin null is not allowed by Access-Control-Allow-Origin. index.html:1"
its seems that angular is still looking for one local file called "kiosk.html". but how can that be? this file (kiosk.html) is already in my dist-folder.
any ideas how to fix it?
thx

This doesn't look like it's really related to grunt at all. It seems like you're trying to make an XHR request that Chrome is regarding as cross-origin. You should try looking for answers regarding "origin null not allowed"
example: https://stackoverflow.com/a/4752452/628699

Related

Google Drive API Console: Error saving Drive UI integration page

I have a webapp in production that interacts with Google Drive through Google Drive API.
I need to change some settings in Drive interaction but I can't save.
When I save the Drive UI integration page, I receive this error:
There's a problem at our end.
Please try again. If the problem persists, please let us know using
the "Send feedback" link below. Thanks!
(spying Network console: there is an Internal Server Error in a POST call)
I tried to send feedback for months: nobody answers and the bug is still there.
I tried also to create another project: I can save the first time but then the bug returns.
How can I do? Has someone the same problem?
Is there a way to receive a reply from Google? Is there some workaround?
Thank you.
i think that problem must be Client ID
before adding Client ID, go to the Credentials -> OAuth 2.0 Client IDs
then select edit your Client ID. after that your production site url add to Authorized JavaScript origins and Authorized redirect URIs.
then enter your Client ID in Drive UI integration page
For myself trying to get the Drive UI configured I noticed a couple of errors (that don't have any specific error messages)
When adding in an Open URL it has to be a valid domain, so for instance I tried to test it out with local host, to no avail. However something like https://devbox.app.com worked, but something like https://localhost:8888 does not. Even though https://localhost is a valid javascript origin in the client_id configuration (at least for the app I am working on, not sure about other apps), localhost doesn't work as an open URL.
When adding in the mimeTypes it needs to be in the format */* and can include custom mimeTypes like application/custom+xml and application/custom-name+json not sure for other custom types that are not in a particular format like xml or json. Also not sure about wildcards.
When adding in file extensions do not add in the '.' just the name of the file extension.
The app icon I found only failed to upload the image when the image wasn't the exact dimensions, I actually ended up editing some icons in photoshop to change the pixel x pixel values as a quick work around during dev.
That worked for me to get it to save and I tested it with a file that had a custom mimeType (application/custom-name+xml specifically) and custom file extension!

Ajax getting 412 (Precondition Failed) sometimes

I am writing a website with Struts and Tomcat as the server.
On a page there's an ajax post request using jQuery (not cross-domain). The returned value is plain html.
The problem is, I sometimes (not always, not even frequent) get 412 (Precondition Failed) error. What could be the cause of this unstable error?
I'm posting an answer because I've just had this issue today. It's obviously an update to Mod Security in my case.
I was sending data to the server via AJAX and some Javascript which was part of this message caused the 412. It turned out to be the word HTML (I was passing element.innerHTML within the code)
ModSecurity treats that as a potential threat by the looks of it. For a quick fix I replaced all HTML strings with H%T%M%L and reversed the process on the server and it's now running.
You've probably long-since solved this but posting in case it's useful for anyone else.
Just today i was facing the same problem "412 Precondition Failed".
It is a Codeigntier app that uploads audio and Image files.
Till now a lot of files uploaded through the Ajax File uploader. But today i file was not uploading and through chrome Inspect > Network i found that error 412 Precondition Failed.
I re-uploaded the file so many file by changing my ajax script multiple times.
Suddenly some special character caught my attention. I renamed the file and tried to re-upload. Trust me it worked.
Before:
AFTER:
I don't have proper explanation but it works for me.
Thanks

getting JSON from PhoneGap application ?

i'm trying to send a getJson call from my app to get an external JSON from PHP file. all i'm getting is a gray empty screen ? can anyone tell me what's the problem or at least how can i debug to get the problem
here also attached the PHP file running !!
You need to provide more Information . Try to debug using Firebug , This is available for both chrome and firefox and since your using html run it in your browser and see what you get.
Do console.log(data); and see what is being outputted in your firebugs console tab. You might be running into some cross domain issue too. Use jquery ajax jquery JOSNP to over come this. just put data: jsonp .
Hope this helps you , please provide more information.

Ajax call from local html page in Webkit Qt

I'm trying to perform an Ajax/XMLHTTPrequest from within a local HTML file in QT 4.7RC QWebview. It consistently fails with an empty responseText and status 0. I've set the follwing
page->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true);
but it has no effect (I can load remote images without problems though).
It seems to be a known issue and I'm not sure if there is a solution already.
https://bugs.webkit.org/show_bug.cgi?id=31875
Any ideas for a workaround would be very helpful. Basically what I'm trying to do is running a HTML/Javascript WebApp in QWebview that talks to a local server at 127.0.0.0 and this problem is kind of a show-stopper. Interestingly, the actual query is sent and my server responds with 200 and the requested data. But the response never arrives in my Javascript callbacks.
Not sure about your question but are you sure that you are inside an AJAX security sandbox that works with webkit? In Firefox, IE and others using AJAXin different domains does not work. In fact, http://demo1.demo.com is different than demo2.demo.com

Allowing Cross domain ajax calls from firefox

I want to change the settings of firefox so as to allow it to make cross domain ajax calls. Since due to the security feature of the firefox it doen't allow ajax calls to be made. I know if it is in same domain it will allow. I have a code given bellow which in safari works fine but firefox doesn't display the results when it calls csce server then since the code is on local machine doesn't allow it and returns error. I know it will start working if I load my this code to csce server but I want to run the code from my machine. So can anyone help me in resolving this. I have spent past couple of days just searching for this solution.
Kindly suggest how to achieve this or should I go with some older version of firefox?
I googled and set the parameters of browser in config file as specified in this site but it still doesn't work.
http://code.google.com/p/httpfox/issues/detail?id=20
Maybe you could use privoxy and tell it to inject something like "Access-Control-Allow-Origin: *" in the server response.
To do this, you would have to go into the file user.filter (create it if it doesn't exist) in privoxys configuration directory and insert something like this:
SERVER-HEADER-FILTER: allow-crossdomain
s|Server: .*|Access-Control-Allow-Origin: *|
Instead of Server, you can also use any other header that's always present and you don't need.
And this into user.action:
{+server-header-filter{allow-crossdomain}}
csce.unl.edu
Note: I didn't test it.
https://developer.mozilla.org/En/HTTP_access_control
http://config.privoxy.org/user-manual/
This appears to enable XSS from file:// pages in Firefox 4, although it prompts you so might not be suitable for more than simple test pages:
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

Resources