简体   繁体   中英

Send complex data from Javascript

I have a WPF application with a WebBrowser control that displays a webpage with JavaScript inside.

From the JavaScript, I can call C# functions. I don't use "Window.External", because I will use Xamarin to make it cross-platforms. Window.external works with a WebBrowser object. On IOS, it will be an other object (UIWebView I think) that doesn't support window.external.

So I call the functions by URL:

window.location.href  = 'myApp://myFunction?param1=' + param1;

It's working, but now I would like to have complex data as parameter (for exemple a config file.), but the URL size seems limited…

Is there a way to do it? Do you know how is it done with Phonegap for exemple ?

Is it possible to modify the Header of a webpage using JavaScript ?

You can use AJAX, a feature of JavaScript which allows you to transmit data seamlessly to and from your server, interactively. To make this easier on you, you could add the jQuery library to your webpage, which helps minimize the amount of code you'll have to write to attain your desired results.

Here's a discussion on StackOverflow regarding relative functionality:

passing complex type as data to jquery ajax post

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM