SharePoint App Model - 500 Server Error loading JS from SharePoint - iis-7

We are trying to get up and running with SharePoint App Model development. However, we are running into a problem.
Firstly, let me state that we have a DNS entry that routes all sundomains in the form of:
*.ourdevserver.ourappdomain.net to the IP of our devserver.
When our app loads, it runs out and attempts to load three js files from SharePoint. Those requests look like this:
MS Ajax:
http:// apps-13c02829da8acd.ourdevserver.ourappdomain.net/_layouts/15/MicrosoftAjax.js
sp.runtime.js:
http:// apps-13c02829da8acd.ourdevserver.ourappdomain.net/_layouts/15/sp.runtime.js
and finally sp.js:
http:// apps-13c02829da8acd.ourdevserver.ourappdomain.net/_layouts/15/sp.js
The GET for each of these files fails with a 500 server error (not a DNS error). This, in turn, prevents the app from working correctly. The code that loads these files is the default code that is created when you start a new SP app project in Visual Studio:
<script type="text/javascript" src="/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
Now, I can change the script reference to dispense with the app-xxxxx subdomain and it will work just fine pulling the three files from ourdevserver.ourappdomain.net/_layouts/15/MicrosoftAjax.js. So, it feels like this is an issue with IIS being able to handle the request.
Any ideas?

You can try like this
<script type="text/javascript" src="_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="_layouts/15/sp.js"></script>
It work for me, becasue your app want get parent side's js files which not allowed.

Related

Host Google sign in client sources locally

We are in the process of implementing Sign In With Google functionality on our website. In the tutorial code snippet, external script is loaded from Google server:
<script src="https://accounts.google.com/gsi/client" async defer></script>
Is it possible to host this library locally? Where can I find all the files that I need to download?
EDIT:
I tried saving the JavaScript file content locally. However, it still tries to load the styles from the external URL (https://accounts.google.com/gsi/style). I guess I could modify the source of JavaScript source code so that it loads this CSS from my server, but it seems like an ugly solution to me. Is there any other way besides modifying their source code?

Do I need to duplicate the script connection in child pages?

In the master page, my script is connected in this way:
<script src="scripts/jquery-3.4.1.min.js" type="text/javascript"></script>
And on the pages at the root, the browser developer console does not show errors,
but the following error appears on the child pages:
... /Pages/Scripts/jquery... (Not Found)
No you don't need to duplicate the script tags, it is being rendered on all your pages which use the master page the script just can't be found on pages outside your root. With your current code when a page is rendered it is starting from its current path and appending the src path to determine where to find the script. So your pages in root work but pages in subfolders will not. To correct this resolve your urls properly:
Webforms:
<script src="<%=ResolveUrl("~/scripts/jquery-3.4.1.min.js")%>" type="text/javascript"></script>
Razor:
<script src="#Href("~/scripts/jquery-3.4.1.min.js")" type="text/javascript"></script>

Deployed Meteor app always returns an HTML file

I deployed my meteor application using this guide, which walks you through nginx setup and writing an Upstart script. Everything works well - I can see that the server is running through the logs in MongoDB. However, making any kind of http request to the app returns an HTML file which looks something like this:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="/936d1dcb9d4c6f9e2d068003929d00edaea39a87.css?meteor_css_resource=true">
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"METEOR#1.0.3.2","ROOT_URL":"http://appname.myserver.com","ROOT_URL_PATH_PREFIX":"","autoupdateVersion":"3fffc72460404bce55af5963e369702ab5a1a85f","autoupdateVersionRefreshable":"7fbcbd377f48fbf1ff3e288e433b9b5bdb25d6dd","autoupdateVersionCordova":"none"};</script>
<script type="text/javascript" src="/5e974726f55e28b0daf88c48237b1131c3d9b50e.js"></script>
<title>api-rest</title>
</head>
<body></body>
</html>
Every script file it references are just this same file, so this is further evidence that every request is just given this response. I'm very confused since deploying the app with meteor deploy appname.meteor.com works perfectly, and there are no logs in the app's logfile.
Does anyone know how to fix this, or know how to begin debugging it?
Use mup: https://github.com/arunoda/meteor-up.
Diginatocean's guide might be outdated, never worked or both. Overall it seems too complicated for such a simple task.

Why is Facebook inserting a preload script for my app's css in HTTP when my page's reference is in HTTPS?

In our app (https://apps.facebook.com/testedenivel), we explicitly reference the page css in a https link like this:
<link rel="stylesheet" href="https://d2asm4nez8zghw.cloudfront.net/content/app-teste-de-nivel.css?v=0.96.02" type="text/css" media="screen">
But strangely, Facebook is preloading this this css file as a HTTP link. At some point before, we used this HTTP url but later we changed it to HTTPS, and now it seems that Facebook is using a former, cached version of that url:
<script type="text/javascript">
new Image().src = "http:\/\/www.talkfast.com.br\/content\/app-teste-de-nivel.css";
</script>
The problem is that when the user enters our app via secure browsing, the HTTP link preloading is causing the browser to alert our users that some insecure content is about to be loaded. We'd like to know how to tell Facebook to remove this preloading script, or at least to use our current HTTPS url, like this:
<script type="text/javascript">
new Image().src = "https://d2asm4nez8zghw.cloudfront.net/content/app-teste-de-nivel.css?v=0.96.02";
</script>
There seems to be scarcity of reference regarding this issue on the web, so any help would be appreciated.
I'm not test this solution in facebook app but on wild web you can use this
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
as proof :)
http://paulirish.com/2010/the-protocol-relative-url/
With this all resources loaded with page protocol, so user don't see confirmation about unsecured elements on page.
Just create test app with Heroku and my chromium not angry about https resouces inside frame so problems depends on browser.

help with script path

how do i reference my script properly so when deployed application won't have a problem finding it?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js "></script>
<script type="text/javascript" src="/Public/Scripts/jqModal.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
I'm using VS2008 Web Forms
I keep getting warnings saying:
Warning 3 Error updating JScript IntelliSense: C:\Documents and Settings\myusername\Local Settings\Temporary Internet Files\Content.IE5\2N4L8DWB\jquery.min-fds90[1]..js: Object doesn't support this property or method # 1:17179 C:\Applications\xxx\xxx\index.aspx 1 1
You could use the ResolveUrl method for scripts that are local to your application:
<script type="text/javascript" src="<%= ResolveUrl("~/Public/Scripts/jqModal.js") %>"></script>
The other 2 scripts are absolute urls referenced from external CDNs so they should be fine and you should leave them as is.
As far as the warning is concerned, simply ignore it. Visual Studio Intellisense in web pages is far from perfect. FWIW in VS2010 it's no better. Hopefully they will fix it in vNext.

Resources