Display the body of webpage in Xamarin forms - xamarin.forms

I want to display the body of a webpage like Microsoft use with "Microsoft News". If I use webview, it will show the whole webpage. So, Is there another control or another way ?
Microsot News:
My App with webview:

You can inject javascript in the LoadUrl method.
For example
mWebView.loadUrl("javascript:(function() { " +
"var head = document.getElementsByClassName('header')[0].style.display='none'; " +
"})()");
From the official documentation.

Related

Google form: Can I add a hyper link that will be opened on a new tab?

I have no idea how to add a hyperlink (that will be opened on a new tab) in a Google form. I know how to do in HTML but I don't know how to do in a Google form.
I have just added a link in the "Confirmation message:" of presentation area of the Google form settings.
...
I think this HTML code cannot be applied to a Google form: (target="_blank")
https://forms.gle/AGz1ngWM7fZXLJkv7
In order to link to another Google form after submitting the quiz, I would like to add the link that can access this other Google form before/after viewing the quiz results. But if I click on the link for this other Google form before/after viewing the quiz in the current tab, I cannot go back to viewing the quiz results.
If it is not applicable to add a link that will be opened on a new tab, it is acceptable to add a link in the quiz results. However, I have no idea how to add a link in the quiz results page.
This is a demo of my quiz form: https://forms.gle/rKrcSh1aGVAeY4sR7
...I have no idea how to add a link in the quiz results page
You cannot.
Fortunately there is a workaround
You can create a small script in the spreadsheet that will send an email to the submitter upon submission of the form.
Go to Tools -> Script editor...
When in the script editor, erase all the presented code and replace it with the following:
The code:
// Email the submitter including a HYPER-LINK
function Hyper2Them(e){
var theirFirst = e.values[4];
var theirLast = e.values[5];
var theirEmail = e.values[1];
var myEmail = "myemail#xyz.com";
var theQuiz = e.values[3];
var subject = "About your Quiz: " + theQuiz;
var message = " Your current EMAIL is: " + theirEmail + "\n To: " + theirLast + " \n\n Dear: " + theirFirst + " \n We will be sending you an EMAIL with your results from: " + theQuiz + " \n Till then please follow instructions found on this address: https://www.google.gr/ ";
MailApp.sendEmail (theirEmail, subject, message);
}
Save
Authorize
Now click on the clock icon on the toolbar and on the new page, set up a trigger for On form submit and save the trigger.
Test and Enjoy!
Notes
The e.values 1, 2, and so on, correspond to the columns on the spreadsheet where the answers are submitted. Keep in mind that the numbering for the columns start with 0. (Zero being the column reserved for the timestamp.)
*You can read all about limitations on Google accounts and triggers at: Quotas for Google Services and Simple Triggers
Another workaround:
Each form has a linked spreadsheet.
Add a sheet with your link or links to this spreadsheet and publish it to the web.
Place the link to the published spreadsheet into the Confirmation message. Moreover you can use formatting on this page.
There is a slight two step workaround for this. Thinking outside of the box... If you have a public webpage / website (if not note you can use a public blogger page for free), you can create a page and add a hyperlink that opens into a new window using either the page WYSIWYG editor or html code. Once the page is ready, in the Google Form "Confirmation Message" you can add the full URL of that page to the message. Note you MUST include the http:// or https:// because this will then open the page within the same iframe as the Google form. If you do not add http it will not load! Within that iframe the form submitter will then view the page you created and when they click the link in that page it will open into a new window. Use common sense. In the "Confirmation Message" tell the submitter what to do, for example, "Click the following links to go to the next section".

How to use Google Apps Script into my Website on button click?

I have an Google apps script and I want to call this Google apps script on my web page?How can I achieve this?This is my Google apps Script code for creating a google doc on my drive.
function createAndSendDocument() {
var doc = DocumentApp.create('Hello World');
doc.appendParagraph('This document was created by my first Google Apps Script.');
doc.saveAndClose();
var url = doc.getUrl();
var emailAddress = Session.getActiveUser().getEmail();
GmailApp.sendEmail(emailAddress,
'Hello '+ url);
}
and I want to call this function when I click on a button on my web page.But I don't know how to call this function on my button click.And one more thing I also save this script and change this version number and deploy as a web app and get the URL of this Google apps Script.
UPDATE: (added incorrectly in an answer)
Actually i am using this line like this.
btnClick.addEventListener("click", function () {
Page.ClientScript.RegisterStartupScript(this.GetType(), "GoogleFunction", "createAndSendDocument()", true);
}
So please now tell me what's wrong in that?When i run my application then it's show me an error like "The Page is not defined".
Look also at this documentation and also this one, everything is clearly explained .
you can add the div and the code in your page as you needed. also you need to add the javascript codes inside your head if it exists.
hi you can use this code on button click after adding a script manager in the form
Page.ClientScript.RegisterStartupScript(this.GetType(),"GoogleFunction","createAndSendDocument()",true);

Submitting froms from silver light to asp.net page

I'm newbie to silverlight , is it possible to submit a from from with in the silver light application . I want to use silverlight controls instaeda of asp.net , they look far better than asp.net controls .How to do this in silverlight 5.
I'm sure you have got your answer by now, but for later readers, I found this way the best way to do this in Silverlight. this way you don't need any aspx pages and you can create and submit html pages directly from silverlight.
it will use Silverlight browser interop to programmatically create an HTML form and set elements to it.
//Creates a blank html document
var htmldoc = System.Windows.Browser.HtmlPage.Document;
// Returns a Reference type to the body of html page
var body = htmldoc.Body;
// Create a <form> element and add it to the body
var newForm = htmldoc.CreateElement("form");
newForm.SetAttribute("action", targetUrl);
newForm.SetAttribute("method", "post");
body.AppendChild(newForm);
//Add your elements to your form
HtmlElement input1 = htmldoc.CreateElement("input");
input1.SetAttribute("type", "hidden");
input1.SetAttribute("name", "someName");
input1.SetAttribute("value", "someValue");
newForm.AppendChild(input1);
//submit your form
newForm.Invoke("submit");
That Simple!
original Answer: This Answer
You can call form.submit() via a javascript function called from a silverlight control
http://msdn.microsoft.com/en-us/library/cc221359%28v=VS.95%29.aspx
and you can also navigate: HtmlPage.Window.Navigate(url)

How to display a non ajax popup

How can i get a popup on homepage like groupon or Yellowpage does. Those are not ajax ones, if i am correct. I am wondering how is it possible to display popups with good images in Asp.net website?
I have used ajax ones before without image!
Use jQuery UI Dialog.
I believe you have some misunderstanding in the concept. AJAX, by definition, is when your web application sends data to, and retrieves data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. You may need AJAX to perform a server operation (like submitting data to the server) or update certain portion of your page smoothly without letting the user feel the flickering (and this MAY include showing a popup).
To answer your question, you need to utilize javascript, HTML, and CSS to accomplish your goal, or else you may use a ready-made library for that, in which I strongly recommend jQuery UI. Check their website for the Dialog extension:
jQuery UI Website
To open a popup in JavaScript, you can use the following:
openChildWindowWithDimensions = function(url, width, height, showMenu, canResize, showScrollbars) {
var childWindow = window.open(url, "", "\"width=" + width + ",height=" + height + ",menubar=" + (showMenu ? "1" : "0") + ",scrollbars=" + (showScrollbars ? "1" : "0") + ",resizable=" + (canResize ? "1" : "0") + "\"");
if (childWindow){
childWindow.resizeTo(width, height);
}
}

How to embed "Share on Facebook" button into Flex application?

I'm trying to duplicate the behaviour of the "Share on Facebook" button from Youtube. Basically, inside a Flex app I'll have a button and when I click it I want a popup that enables me to post something on the wall.
While it is possible to make a call to javascript to open the pop-up I want to be able to set the images and the text of my posting.
Do you know how I could set the images or text as a paramter to the sharer window?
Thank you!
This is fairly straightforward to do. Youtube uses the Facebook API which pops up a new window (Info on Facebook sharer API).
To do this in flex,
Create a button that onClick will call a javascript method, ExternalInterface.call("fbLink", "www.yahoo.com");
In your HTML file (most likely index.template.html) add the JavaScript method, fbLink which does the following:
function fbLink(url) {
window.popup("http://www.facebook.com/sharer.php?u=" + url, {height:440, width:620, scrollbars:true})
}
Now when a user clicks on the button they will be sharing the link "yahoo.com" with facebook account.
as I understood you asking for some help in accessing js popup in html page of facebook share button, so you should use ExternalInterface in this casa and access needed DOM node using getElementById function in your js interface.
In other case I want propose you to read another one way http://www.riaxe.com/blog/flex/publish-into-facebook-wall-from-flex/
It seems that you want to have a button on the flash application and once clicked it opens the facebook page that shares the video/image that pertains to the clicked button. What you want to do is simply create a button that on click opens a new website to facebook using their share api which has the following format:
var facebookShare:String = "http://www.facebook.com/share.php?u=' + encodedVideoLink + '&t='+ encodedVideoText";
Where the u parameter stands for the link that you wish to share, and the t parameter stands for the title of the piece that you want to share, whether it be a picture or video.
You want to add an event listener on MouseEvent.CLICK that has as its callback function a method that handles the opening of the facebook page passing the facebookShare variable as shown above. To open another page on your browser you can use this AS3 Class called URLNavigator: http://www.danishmetal.dk/project/source/com/zorked/URLNavigator.as
To sum it up, something along these lines would do:
var facebookShare:String = "http://www.facebook.com/share.php?u=' + encodedVideoLink + '&t='+ encodedVideoText";
facebookButton.addEventListener(MouseEvent.CLICK, this._goToUrl(facebookShare));
private function _goToUrl(link:String):Function {
var window:String = "_blank",
feats = "",
thisOverlay:Object = this; // to not lose scope when returning a func
return function (e:MouseEvent):void {
trace("Opening link to:"+link);
try { URLNavigator.ChangePage(link, window, feats); }
catch (e:Error) { trace("error launching "+link+" in "+window+" with feature set "+feats); }
}
}
I hope that helps. If you have questions regarding the code please let me know.

Resources