Microsoft JScript runtime error: Access is denied Dropbox.js in IE - javascript

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.9.0/dropbox.min.js"></script>
Hi am using above file to access dropbox functions. It contain all the dropbox functions. i included this one to my application and i
used the below code to upload a file to dropbox using writefile function.
This was working fine in chrome and Mozilla browser but in IE its getting an error.
The error is: "Microsoft JScript runtime error: Access is denied".
Please anyone help me how to resolve thid IE Error and tell me the reason why this error coming only for IE Browser?
var UploadToDropbox = new Dropbox.Client({ key: consumerKey, secret: consumerSecret, token: accessToken, tokenSecret: accessTokenSecret, dropbox: true });
UploadToDropbox.authenticate(function (error, UploadToDropbox) {
if (error) {
alert('Something wrong here.');
}
else {
UploadToDropbox.writeFile("HelloWorld.txt", "Hello, world!\n", function (error, stat) {
if (error) {
return showError(error); // Something went wrong.
}
alert("File saved to your dropbox successfully. ");
});
}
});
Hi thank you for your reply my question and i tried like that but still that same error coming.
Ok now what should i do for resolve this error.
and i tried with this also
<script type="text/javascript">
// Hack to make dropbox.js works in IE8, IE9.
if (!window.btoa) window.btoa = base64.encode;
if (!window.atob) window.atob = base64.decode;
</script>
but same error.

Open IE->Tools-->InternetOptions
In Security Tab->select Zone as Internet-->Click Custom Level Button---> Check "Enable" in Access data source across Domains under Miscellaneous.
It seems that IE does not play well with javascript events that trigger a DOM control. So try to remove such event actions , if they are present .
Usually means that you are attempting to update a property or access content that is not permitted under your current security settings.
Sometimes, it also happens due to usage of deprecated method .

The hack in your question is not necessary. dropbox.js packages its own implementation of atob / btoa, which is used on IE <= 9. You can try it out by accessing Dropbox.Util.atob and Dropbox.Util.atob in the IE Developer Tools console.
base64 code: https://github.com/dropbox/dropbox-js/blob/master/src/base64.coffee
First, please run the checkbox.js sample code to check your IE settings. If the sample works (you can log in, add tasks, mark them as done and remove them) then your IE settings are OK, and the problem is elsewhere.
checkbox.js: https://dl-web.dropbox.com/spa/pjlfdak1tmznswp/checkbox.js/public/index.html
Second, make sure that you're serving your HTML page using https://. The Dropbox API server uses https, and IE <= 9 doesn't allow cross-domain requests from http pages to https servers.
Third, you shouldn't need the token and tokenSecret parameters in the authorize call.
If you still get the JScript runtime error, can you please point to the line of code that causes it? Also, consider opening an issue on the dropbox.js GitHub page. This will get faster responses.

Related

PDF.js not working when deploying to different Server in IE

I have a local IIS site where i developed some code with PDF.js. There it worked fine to load a specific PDF and read the text contents from it.
Then I copied everything to the a library in a SharePoint Server (thats the only difference, IIS vs SharePoint) and changed all references. The code does not throw any Errors, with debugging level info it just prints
Info: Cannot use postMessage Transfers
to the console. Adding a console.log line into the PDF.js catch block of the promise did not result in any new information. It doesn't even get to the first logging inside the then:
var pdfobj = PDFJS.getDocument(docPath);
pdfobj.then(function (pdf) {
console.log(pdf);
any ideas?
EDITS: Updated from PDF.JS 1.1 to 1.2
There are not many error logs in PDF.js. I accidently hardcoded a wrong URL where even the server is non existent... and no error log, not even the then(...).catch(...) is called?
It is working now in Firefox but not in IE and I cannot see any reason for this. The Info message about Cannot use postMessage Transfers is also only displayed in IE (using IE 11).
It does work now. I am not sure what I did to fix it, but I will update this answer when I know. I think it has something to do with the directory structure of the PDF.js files. Previously I just uploaded all JS files (there were no errors though).
Still there is no exception handling when the PDF does not exist.

Access is Denied on IE11 in AngularJS

Every development pipeline has 2 parts. FIRST to work hard and develop the application. SECOND to work harder and make it compatible with the great arrogant IE.
We have an AngularJS (v1.3.13) application without any server side code developed in Webstorm. We are making REST calls to service. Our application works fine on Chrome and Firefox without any Console errors. However when we try to open the page in IE11 or IE9 (not tried IE10), our page doesn't load. Console suggests we have 2 errors. One of them is Access is Denied on
xhr.open(method, url, true);
in angular.js.
There are number of posts on internet and none seems to be working. This is what I have tried.
Hosting app in IIS with changed Handler Mappings to support Cross Domain calls on an Application pool of .Net v4.0 (as suggested by a Senior)
Tried to disable to cache for HTTP requests.
Adding Domain in trusted site category and also adding locahost/IP to local intranet.
Changing request type to JSONP and trying to add Access-Control-Allow-Origin (with value of *) to headers.
Changing IE settings to allow Cross Domain calls.
Error is still chasing us. Even my colleagues have tried the same on their machines ending up with similar blow. Is there anyone to suggest me something on this.
It may be CORS and I may need to go for xdr (XDomainRequest) but not sure how to use it as error is in angular.js. I am certainly no expert on this so please suggest.
Screen shot of the error:
IE shows another error:
[$injector:nomod] Module 'ngLocale' is not available!
You either misspelled the module name or forgot to load it.
If registering a module ensure that you specify the dependencies
as the second argument.
http://errors.angularjs.org/1.2.16/$injector/nomod?p0=ngLocale which I am ignoring for now.
Please suggest me something on this.
Thanks.
I switched from 1.3.4 to 1.4.8 and that did the trick. No more Angular Access Denied in I.E. (Microsoft Edge 25 2015). I don't know why.
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-route.js/1.4.8/angular.min.js"></script>
Access is Denied on IE11 in AngularJS error have a solution on this link
I also got the same error while downloading Image from IE11. I have just added the following line in my code and It works.
window.navigator.msSaveBlob(blob, paramDataObject.fileName);
or
window.navigator.msSaveOrOpenBlob(blob, paramDataObject.fileName);
Have you tried xdomain? https://github.com/jpillora/xdomain it's a pure javascript CORS alternative.
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob);
}
else {
var objectUrl = URL.createObjectURL(blob);
window.open(objectUrl);
}
Setting window.location or window.open in AngularJS gives "access is denied" in IE 11

gapi.client.load not working

I have the following code, which is supposed to be a simple example of using the google api javascript client, and simply displays the long-form URL for a hard-coded shortened URL:
<script>
function appendResults(text) {
var results = document.getElementById('results');
results.appendChild(document.createElement('P'));
results.appendChild(document.createTextNode(text));
}
function makeRequest() {
console.log('Inside makeRequest');
var request = gapi.client.urlshortener.url.get({
'shortUrl': 'http://goo.gl/fbsS'
});
request.execute(function(response) {
appendResults(response.longUrl);
});
}
function load() {
gapi.client.setApiKey('API_KEY');
console.log('After attempting to set API key');
gapi.client.load('urlshortener', 'v1', makeRequest);
console.log('After attempting to load urlshortener');
}
</script>
<script src="https://apis.google.com/js/client.js?onload=load"></script>
except with an actual API key instead of the text 'API_KEY'.
The console output is simply:
After attempting to set API key
After attempting to load urlshortener
but I never see 'Inside makeRequest', which is inside the makeRequest function, which is the callback function for the call to gapi.client.load, leading me to believe that the function is not working (or failing to complete).
Can anyone shed some light on why this might be so and how to fix it?
Thanks in advance.
After spending hours googling the problem, I found out the problem was because I was running this file on the local machine and not on a server.
When you run the above code on chrome you get this error in the developer console "Unable to post message to file://. Recipient has origin null."
For some reason the javascript loads only when running on a actual server or something like XAMPP or WAMP.
If there is any expert who can shed some light to why this happens, it would be really great full to learn.
Hope this helps the others noobies like me out there :D
Short answer (http://code.google.com/p/google-api-javascript-client/issues/detail?id=46):
The JS Client does not currently support making requests from a file:// origin.
Long answer (http://en.wikipedia.org/wiki/Same_origin_policy):
The behavior of same-origin checks and related mechanisms is not well-defined
in a number of corner cases, such as for protocols that do not have a clearly
defined host name or port associated with their URLs (file:, data:, etc.).
This historically caused a fair number of security problems, such as the
generally undesirable ability of any locally stored HTML file to access all
other files on the disk, or communicate with any site on the Internet.

(NS_ERROR_DOCUMENT_NOT_CACHED) through firefox same code works for safari

I am getting (NS_ERROR_DOCUMENT_NOT_CACHED) error when I try to access the Javascript code through firefox.I get this error in the contents tab of HTTPFOX.
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
Can somebody suggest whats going wrong since the same code works fine for safari browser..
If anyone is interested in a solution to this, I believe it's to do with the plugin noscript. Disabling it fixed this, but I have yet to work out what part of noscript was causing the issue. Will update if I find out.
Edit:My issues was with a twitter auth callback. In the Advanced settings of noscript under ABE, in the SYSTEM ruleset, on the line "Accept from LOCAL" I added "*.twitter.com". This allowed callback requests from *twitter.com to return to a local address.
On my macbook I had to uninstall firefox completely to correctly get the content of an ajax response with httpfox. This also implies to remove the firefox profile bij removing this Firefox folder (I could only find it via the terminal and not via Finder):
/Users/<YOURUSER>/Library/Application Support/Firefox
Then install firefox again and install the httpfox add-on.
I tried many cache settings also by entering about:config in the firefox URL however without succes. Be aware that removing the profile settings like I describe will also remove all your personal firefox customization. It concerned firefox 18.0.2 and httpfox 0.8.11.
We used to get the same error when our JavaScript made an XMLHTTPRequest to the server. On the server side, we had java, and the java response, the content type was not explicitly set to "text/html". When that was done
resp.setContentType("text/html");
the error went away.

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