Posts marked with "URL" in tags

Make Headers Jump Links In WordPress Posts

You might have noticed that the

,

headers in my blog posts are links that can be used to jump to that section. These links are called Jump Links.

These Jump Links can be sent anywhere on web for reading that particular section. This is very useful for tutorials as when someone comments a problem, we can use the link to redirect that user to the section where the solution is situated.

... [READ MORE]

Add @mentions To Input Fields – jQuery sMention Plugin

Mentioning persons using **@ **is pretty common on social web sites. Facebook, Google+ and even StackOverflow have the **@mention **feature. They developed it on their own and doesn’t share the code with others. If you are developing a social site, then it’s better to have this mention feature. I wanted this, but the jQuery plugins I found was too big.

The first plugin I found was 20 KB ! This made me create a plugin of my own to accomplish my need. Hence I created sMention – a plugin that implements the @mention feature on elements. I created it in a day, so there might be errors and it isn’t perfect. I made a GitHub repository for sMention. You can contribute to sMention by suggestions, feedback and reporting bugs.

... [READ MORE]

How To Create A Simple Web Crawler in PHP

A Web Crawler is a program that crawls through the sites in the Web and indexes those URL‘s. Search Engines uses a crawler to index URL’s on the Web. Google uses a crawler written in Python. There are other search engines that uses different types of crawlers.

In this post I’m going to tell you how to create a simple Web Crawler in PHP.

The codes shown here was created by me. It took me 2 days to create a simple crawler. Then How much time would it take to create a perfect crawler ? Creating a Crawler is a very hard task. It’s like creating a Robot. Let’s start building a crawler.

... [READ MORE]

How To Check If Internet Connection Exists In jQuery & Javascript

If you are running an app on the web that requires Internet Connection all the time, sometimes the internet connection will fail on the client side and your app won’t properly work. The best example is the New Tab Chrome Apps that will display the URL icons grayscale when offline and will make the icons back to color when online. To check whether the client’s internet connection is online, we use jQuery. You can also use Javascript to check. I will tell you how to do the checking in both jQuery and Javascript.
The checking is simple. We will send a request to one of the site’s image. If the request was successful, the Internet Connection is active and if it’s not successful, there isn’t any active Internet Connection. It’s as simple as that. The following modal will make you understand the concept easily :

... [READ MORE]

How To Change The Browser URL Without Refreshing Page – HTML5

This post was suggested by Sumit Kumar Pradhan. I recently saw many questions like this on Stack Overflow. Let me start explaining, there is already a function in JavaScript to do this special task. The function is window.history.replaceState. It’s a simple function that needs 3 values.
This is actually a HTML5 function that came out on July 2012 (I think). All the latest browsers support the new function except IE 9.

Here is a small example of the usage of window.history.replaceState :

... [READ MORE]

Create Your Own URL Shortening Service Using PHP & jQuery

I made a URL shortening service a year back using PHP & jQuery. It was pretty simple. You should know the concept of URL Shortening. The concept is simple. When a user sends a request to short a URL, PHP will check if the URL is valid. If it’s valid then PHP will make a string of 5 or 6 characters. A folder is created with the name of this string and an index.php file with header function code is created in this folder. This will make the folder redirect to the URL the user requested. Since it’s a folder no extensions will be seen ! So You can make up some pretty good URL‘s.

... [READ MORE]

Program to Replace localhost links with website url

If you are working on a project and wants to upload the project to your site, then you have to manually replace all the localhost links with the site url. I created a small Python program that will replace localhost links with your WWW site url.
Here is the Python code :

#!/usr/bin/python
import os
indir = ‘/var/www/mysite‘ #!Folder of your localhost site.
for root, dirs, filenames in os.walk(indir):
 for f in filenames:
  log = open(os.path.join(root, f), ‘r+’)
  f=log.read()  
  n=f.replace("http://localhost", "http://mysite.com")
  log.seek(0)
  log.truncate()
  log.write(n)
  log.close()
print "Successfully Replaced."

... [READ MORE]

Preventing double encode of URL in PHP

There is no practical way to check whether an URL is encoded or not to encode if it’s not encoded. But you can do encode the URL by first decoding like below:

$string = url_decode($url);

And then you should encode as to prevent double encoding.

$string = url_encode($url);

By doing this we can prevent double encoding of URL‘s.

... [READ MORE]

Encode/Decode URL in Javascript and PHP

URL encoding and decoding can be done in both Javascript and PHP. In this post I’m going to tell you the functions used in both languages for url encoding/decoding.
Javascript
 Encoding

encodeURIComponent(url);

Decoding

decodeURIComponent(url);

PHP
 Encoding

urlencode(url);

Decoding

... [READ MORE]

How to find Blogger Blog ID

You may need your blogger blog id for various needs. Here’s a simple tutorial on how to find the blog id.

Go to your blog dashboard on Blogger. See the url of the page in the location bar.
In the page url you can see a text blogID= followed by a number until it stops with #.
Here’s a sample url :

http://www.blogger.com/blogger.g?blogID=123456789101112#overview/src=dashboard

The wheat color background text in the above url is the blog id of that blog.
... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab