Presentation is loading. Please wait.

Presentation is loading. Please wait.

INFO 344 Web Tools And Development

Similar presentations


Presentation on theme: "INFO 344 Web Tools And Development"— Presentation transcript:

1 INFO 344 Web Tools And Development
CK Wang University of Washington Spring 2014

2 Cross Domain Scripting
Simple PHP script, 3 lines of code It works! Download html file, run locally (different domain) doesn’t work  Browser blocks cross domain AJAX

3 Why? Security!! If we allowed cross domain scripting Imagine
Go to Download their html files Host those files on Get users to login! AND now I can do anything with their data & account!

4 JSONP JSON with Padding Use <script> tag
Pass a call back function <script> will have function(data)

5 JSONP Open Visual Studio, C# Web Application, Empty
Add new ASMX web service Implement WebMethod for getOneLessThanN(int n) Add http get/post to web.config Uncomment script services & add script method/response format = JSON, need to clear context to remove meta data Publish on Azure! (as a web site)

6 JSONP Create jsonp.html, add <script> to your service, for example: updateResults is your callback <script> to your service will generate javascript that calsl your callback function

7 JSONP Part 2! Write a version using jQuery.
Part 3: How would you write your own JSONP wrapper? i.e. implement this ajax jsonp call?

8 Reading

9 Questions?


Download ppt "INFO 344 Web Tools And Development"

Similar presentations


Ads by Google