I've got an app in sharepoint 2013, which is showing up inside of an iframe. I'd like to have links to the page that has the app embedded elsewhere, and pass data to my app through those links. Sounds like a job for query strings, right?
However, I can't find a way to get the query string in my app. None of the tokens I tried inserting had it, and I couldn't get it from within javascript because the url for my iframe and for sharepoint are different. Any ideas?
if your app is within the SP page use
document.referrer
to get the full URL including query
Related
I want to create a web application using react in which I want to load a page based on the link used, But I know that in react whenever you visit a direct link the entire app is reloaded and you have to navigate to that page using buttons or links provided in the app, I want to generate a temporary link for users which will contain the information about the data to be provided which the back end will check and retrieve from database and provide to the front end, This link will have a duration like for 24 hrs or something and will have an auth token, Can anyone please help me with how I can do that?
React Router is a library that can handle this type of operation and is used in many, many apps. Among other things, it can parse URLs and render different content based on the URL, query parameters, and more.
I am trying to retrieve data of page type via rest service in Kentico 10.
What should be format of base URL for sending Post request and for checking content on browser?
If you want to retrieve content you have to use GET (not POST). POST is for creating resources, PUT is for updating.
From the documentation:
The base URL of the Kentico REST service is /rest.
For example, if your site is running at http://localhost/Kentico, use
http://localhost/Kentico/rest as the base URL of the service.
This is how you retrieve all documents with all their coupled data:
http://localhost/Kentico/rest/content/currentsite/en-us/all/?coupleddata=true
Again, see the documentation for all the examples.
Try something like this:
/content/currentsite/<culture>/all/?classnames=<class code name>
Here you can find all the details on getting content/data via Kentico rest service.
I have a HTML page stored as web resource in CRM 2013. I have a report from which I need to pass all records guids to this HTML page. I am able to pass the record guids(Comma separated list) successfully. However, when the URL length exceeds 2000 characters, I am getting a "404 Resource not found" error. This is due to URL length limit. Is there a way I can pass the record guids using POST method to HTML page from SSRS which will work for any number of records?
The simplest approach seems to be storing the record guids as a variable on the SSRS report via something like
=Code.WriteHTML("<script>window.recordGuids=[" & recordIds & "];</script>")
and then in the web resource use something like
var ids = window.opener.recordGuids;
But that will likely only work in the browser and the report would have to be viewed from CRM.
Otherwise, you could do a post to an external service, which could launch the web page and allow getting the ids through a caching mechanism mixed with a jsonp call of some sort.
I have a Windows Phone 8 app. My app needs to POST some data to a web page that I have on my server. Please note, I am trying to POST to a web page, not a web service. The reason that I need to POST to a web page is because 1) I'm trying to render some contents in a web page that is currently launched via a WebBrowserTask 2) I am passing a large amount of data to the web page.
From what I can tell, the WebBrowserTask only allows "GET". Now, I'm totally lost in regards to what to do. Is there a was to POST data via a WebBrowserTask? If not, is there a way to serialize my data as JSON and cram it into the query string? I know that's ugly. At the same time, I'm not sure what else to do.
Thank you
Try adding a WebBrowser control then make your request through either WebClient or HttpWebRequest. Once you get the html response use the NavigateToString(string) method to display the result.
But you can simply use the Navigate(uri) method if you only need to specify some query string params.
The new Facebook Javascript SDK can let any website login as a Facebook user and fetch data of a user...
So it will be, www.example.com including some Javascript from Facebook, but as I recall, that script is considered to be of the origin of www.example.com and cannot fetch data from facebook.com, because it is a violation of the "same origin policy". Isn't that correct? If so, how does the script fetch data?
From here: https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript
The same origin policy prevents a
document or script loaded from one
origin from getting or setting
properties of a document from another
origin. This policy dates all the way
back to Netscape Navigator 2.0.
and explained slightly differently here: http://docs.sun.com/source/816-6409-10/sec.htm
The same origin policy works as
follows: when loading a document from
one origin, a script loaded from a
different origin cannot get or set
specific properties of specific
browser and HTML objects in a window
or frame (see Table 14.2).
The Facebook script is not attempting to interact with script from your domain or reading DOM objects. It's just going to do its own post to Facebook. It gets yous site name, not by interacting with your page, or script from your site, but because the script itself that is generated when you fill out the form to get the "like" button. I registered a site named "http://www.bogussite.com" and got the code to put on my website. The first think in this code was
iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.bogussite.com&
so the script is clearly getting your site info by hard-coded URL parameters in the link to the iFrame.
Facebook's website is by far not alone in having you use scripts hosted on their servers. There are plenty of other scripts that work this way.. All of the Google APIs, for example, including Google Gears, Google Analytics, etc require you to use a script hosted on their server. Just last week, while I was trying to figure out how to do geolocation for our store finder for a mobile-friendly web app, I found a whole slew of geolocation services that had you use scripts hosted on their servers, rather than copying the script to your server.
I think, but am not sure, that they use the iframe method. At least the cross domain receiver and xfbml stuff for canvas apps uses that. Basically the javascript on your page creates an iframe within the facebook.com domain. That iframe then has permission to do whatever it needs with facebook. Communication back with the parent can be done with one of several methods, for example the url hash. But I'm not sure which if any method they use for that part.
If I recall, they use script tag insertion. So when a JS SDK call needs to call out to Facebook, it inserts a <script src="http://graph.facebook.com/whatever?params...&callback=some_function script tag into the current document. Then Facebook returns the data in JSON format as some_function({...}) where the actual data is inside the ... . This results in the function some_function being called in the origin of example.com using data from graph.facebook.com.