Search webpage for http URLs using Javascript [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How would search a webpage for http links? When a page is using HTTPS, I'd like to find all links to insecure content. I thought about using indexOf or regex but cannot seem to come up with how I could search the whole page.
I have also tried document.getElementsByTagName with no luck.

I suppose you could use document.querySelectorAll and find all elements with attributes src and href that start with http:// like so:
var insecure_content = document.querySelectorAll('[src^="http://"],[href^="http://"]');

Related

How to get the page title from Wikipedia page URL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to create a system where the user will input their Wikipedia page link, and the application will get the page title from Wikipedia page URL.
Like, if the user gives: https://id.wikipedia.org/wiki/Eminem, I want to get the page title Eminem.
Or if the user gives: https://id.wikipedia.org/wiki/Eminem#1992%E2%80%931997:_Awal_karier,_Infinite_dan_masalah_keluarga, I want the page title, which is Eminem
I've tried finding a regex pattern. I'm thinking about what if I could create/ find a regex pattern that would find words that sit between /wiki/ and ends with a /. So far didn't found any way to do that.
So what can I do? What other options I have?
this would partly work: /(?<=https?:\/\/..\.wikipedia\.org\/wiki\/).+(?=\/(.+)?|#)/
It doesn't work without a / at the end though.

Detect if user is directed from you website [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to play an animation when you are not redirected from my page (when you have not clicked a link on My page and got redirected to another page on My page) much like: animade.tv
It there any way to detect that with javascript? If not, can you do it with php?
You can use both js or php
js:
document.referrer
php:
$_SERVER['HTTP_REFERER']
sometimes it could be empty, you can just verify that is different from your domain
use document.referrer to test the url

whats the fastest way to load images using javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Lets say I have an ecommerce site with 15,000 image elements to insert into the html, whats the most efficient method using javascript to increase efficiency and user experience?
Load the images only when they are in the view port.
This question tells you how:
How do you make images load only when they are in the viewport?
Preload the images and use the cdn to host your images.
You can use something like https://github.com/thinkpixellab/PxLoader to preload the images.

Get value from another site (yahoo)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
there is a wayto get the value from yahoo site in this url "http://finance.yahoo.com/q?s=mo&ql=1". i need only the value of "Next Earnings Date".
how to do that in ajax?
Since Cross-Domain-Requests are not allowed in Browsers, you can't do it with pure JavaScript. You can either use php with curl to fetch the page and parse it, or use a helper API.
I would recommend having a look at YQL (Yahoo Query Language). With this API you can fetch any page.
https://developer.yahoo.com/yql/console/
A jQuery plugin that makes use of this API is: https://github.com/padolsey-archive/jquery.fn/tree/master/cross-domain-ajax

Buttons with a textarea on web page [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Could someone please point me at a resource that shows how to add buttons to a textarea on a web page? Similar to Yahoo mail where an email address is turned into a button with a cross for removal.
In fact exactly how tags are added to the Tags textarea on this site.
There are very good jQuery plugins that accomplish this. One of them is tag-it library. You can find examples on this page, as well as source code and documentation on how to use it. You can always style it according to your needs through css.

Categories