PowerApps – Add a Google search web part to your modern SharePoint page in 5 minutes

For most organisations google is the most used site. As many organisations set the default browser home page to a SharePoint intranet many users may find that they are redirected to the site that they don’t want to get to. An easy solution would be to add a Google web part to a page.

Something as simple as the following JavaScript could do the job.

<br />< script>
function searchGoogle() {
alert('click');
var query =document.getElementById('querybox').value;
window.open('https://www.google.com?q=' + query, '_blank');
}
< /script>
< div>< img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />
< input id="querybox" name="query" type="text" />< input type="button" value="Search" />
< div>

But, this doesn’t work on the modern pages as script tags are not allowed in the Embed web part. Of course you could create an SPFx web part but there is an easier solution

No Script

Create a PowerApp

Start by creating a blank PowerApp and set the height and width to 450×90.

Then add 3 controls.

  • an Image and set the image to the google logo
  • a Text Input box
  • Search icon

Set the Onselect of the Search icon to

Launch("https://google.com/search?q=" & TextInput1.Text)

Then save and publish the app and add the web part to your page.

 

 

Advertisements


Categories:Office 365, PowerApps, SharePoint Online

Tags: ,

3 replies

  1. That works great, but… how can I activate the search when the user hits the Enter key, instead of needing to click on the Search icon with the mouse?

    Like

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: