How to add google results for a given search string to a website - integration

the thing is, I have some given words and I want to search through my website for them, and display them to the user, but without the user entering any stuff.
Thanks so far!
UPDATE
and it should not be an iFrame ;-)

well ...
I found quite an easy solution, which is actually provided by google itself: http://www.google.com/cse/manage/create
it does not run in an iframe as well. I like it pretty much ;-)

Related

Is there a way to filter numbers in a html page?

it's for work so i can't disclose details, but basicly orders come in and they get listed via a external website. the thing i want to do is to list them so i can copy them easily. i've been searching for a way to export the page to excel, but this didn't work out. now i'm looking into devtools for chrome to filter them out.
what i'm looking for is a way to filter a bunch of numbers from a page, and quickly be able to copy them. it doesn't really matter how. below i added a picture to show the overall scructure of the page itself.
All suggestions are welcome!
greetings, niels
Yes you can with Javascript.
However, the image you provided does not contain the necessary information to help solve your exact question.
Get the element that contains the value that you want to receive via element inspect in your browser.
Use .innerText to retrieve the value inside of the element.
For example, let's say I want to fetch your Stackoverflow username from this post, here's how that would go (you can copy paste the code in your web-console to see the result):
document.getElementsByClassName('user-details')[0].childNodes[2].innerText
The same principle applies to numbers or other values/data. Without the page structure, it is impossible to give you a concrete answer to your question. Hopefully the above gives you some guidance as to what you should be looking for.

Make a Search Box that will Search a Websites Text in HTML

So I need to have a search box search through text on a web page and show relevant searches. I have no clue how to do this and didn't find anything online on how to. So if I have a search box on www.example.com/index.html, and and user enters text into it, then it searches the text on www.example.com/example.html and displays the result. Finally just an FIY it needs to be in HTML. Thanks for any help in advanced!
Well, you would need to know javascript (and probably php) to do that properly, which your request sounds like you do not.
If you need to add a search engine without knowing javascript/php, then your best bet is probably to look into something like Google's Custom Search - https://support.google.com/customsearch/answer/2630969?hl=en
Setting it up sounds simple enough for someone who doesn't understand what the code is actually doing - all copy and paste. Don't do that with any old script on the web, though. There's plenty of dodgy ones out there!

Always avoid using <iframe>?

Some days ago, some friends of mine told me to avoid using <iframe> for virtually anything, which of course includes Google Maps. That made me do some research and, among other things, find this thread in Quora (http://www.quora.com/Google-Maps/What-are-best-practices-and-recommendations-to-implement-Google-maps-within-an-iframe-on-a-webpage), which I think isn't conclusive, at least in my case. I've made a simple site which includes displaying a Google Map. I used an <iframe> because it is very simple and, as pointed out before, it is the option that Google offers within every map, so I guessed it was the optimal one.
My question is: using an <iframe> is always a bad solution, or in a simple case like mine (only displaying a location map), is it recommended?
Thank you all, please let me hear your thoughts on this,
João
Using an iframe is like having another page loaded in your browser. Which takes resources. I think this is what the suggestion to avoid it based on. But naturally, the solution is to avoid those who suggest that you should avoid something always. Just use it when it makes sense and know where to stop.

Enlarging Image in New Window?

I just did a quick search for my question and couldn't find anything directly on point.
I'm still very new to HTML and was wondering if someone could tell me how I could add a picture to my website and set the code so that if I click on it, it enlarges the picture in a new window.
I'm going to be adding around 600+ pics to my website so I was also wondering if there's a way to write the code once and have it apply to all the pics I add.
Thanks in advance,
- Danny B.
There's many many ways in which you could do this. The basic HTML for inserting an image with a link to a new window will be:
<a href="enlarged.html" target="_blank">
<img src="photos/photo-name.jpg" />
</a>
But it is a fair bit more complicated if you want to be able to dynamically display a large number of photos. If you want to code this yourself, you'll want to look into using something like PHP to output the HTML code automatically for 600+ images. Then instead of pointing the link for each to a new page, you might want to consider having the images load in a cool way, such as a javascript lightbox/colorbox some of the other answers suggest.
One possible alternative solution might be to look for some pre-created photo album script. I don't have any experience of these so I'll let someone else make some suggestions on that.
There are several ways to do this, but I'm assuming you'll have a simple site with lots of images on one page, and you'd like the images to zoom open "in a cool way".
Check out this: http://colorpowered.com/colorbox/
... click on View Demonstration and then see the various photo handling options.
This needs just some basic HTML and minimally configured Jquery. Very simple to use and produces a nice effect.
Google around using the keyword lightbox. Most of the solutions are ready-to-use Javascripts. Just include once, assign some IDs/classes, execute during onload and that's it. I personally have good experiences with Lightbox2 and jQuery Lightbox plugin.
I decided to go w/ target="_blank" -- Lightbox2 seems like it'd be great, but I'm really not sure how to use it and where to put all the code. The instructions I've found for it still assume the user has some standard knowledge in the field, that of which I do not currently possess. So, I'll stick to the target/blank approach until I can get more familiar w/ coding and then I'll upgrade to Lightbox.
Once again, I want to say thanks to everyone. You guys always respond quickly and accurately.
With much appreciation,
- Danny B
The simplest way would be to add a link to it, and set the target attribute to target="_blank". The link should point to the image itself. This would regularly open a new tab though, if you want a whole new window, you should tryhref="javascript:window.open('myimage.png','_blank','toolbar=no,menubar=no,resizable=yes,scrollbars=yes')",which would open a new, standalone window. If you're looking for fade/resize effects and such, try one of the other answers posted.

Scraping hidden HTML (when visible = false) using Hpricot (Ruby on Rails)

I've come across an issue which unfortunately I can't seem to surpass, I'm also just a newborn to Ruby on rails unfortunately hence the number of questions
I am attempting to scrape a webpage such as the following:
http://www.yellowpages.com.mt/Malta/Grocers-Mini-Markets-Retail-In-Malta-Gozo.aspx
I would like to scrape The Addresses, Phones and URL of the next Page which in this case is
http://www.yellowpages.com.mt/Malta/Grocers-Mini-Markets-Retail-In-Malta-Gozo+Ismol.aspx
I've been trying just about anything i could think of but nothing seems to work due to them being set to invisible or so.
The Address is within an h3 tag but it does not appear to be scrap-able. I've been also looking into ScRUBYt from the following url http://www.rubyrailways.com/ajax-scraping-with-scrubyt-linkedin-google-analytics-yahoo-suggestions/, but i really cant seem to find heads or tails of how to apply them in this case.
I would really appreciate any pointers as this is an obstacle which i really need to surpass in order to move forward on my assignment. Thanks in advance for any help.
In the particular example you have given, the elements are not hidden, but loaded via ajax after the page load. So basically what you need is a http client which can run javascript (web browser?) to see those address and other contents.
If you want to really automate the process and scrape the data which is got through ajax or javascript, you can try selenium. Even though it is not developed for that purpose, it serves your needs.
I don't have an answer to your specific question, but I thought I'd point to Ryan Bates' Railscast episode on screen scraping with ruby: http://railscasts.com/episodes/173-screen-scraping-with-scrapi
He uses a library called scrAPI instead of ScRUBYt, since he couldn't get ScRUBYt working. scrAPI seems to be a bit easier maybe?
I hope this helps somewhat, good luck with your assignment! :)
-John
There is a good script posted at the google group. It seems to extract address, etc. You may want to look at the code for the script page.txt.