Post your Questions, Observations, Comments, Ideas and receive feedback from members. Listen to the "wisdom of the crowd"

Author Topic: A shortcut for your website  (Read 1167 times)

Offline osofem

  • Moderator
  • Newbie
  • *****
  • Posts: 28
  • What do you think +1/-0
  • Gender: Male
  • I am Osofem. I program. That is just me
    • View Profile
A shortcut for your website
« on: May 06, 2013, 04:04:22 PM »
Introduction
Have you ever wondered that having to remember and type the URL of your webpage over and again might be frustrating for some users of your website? That was why the internet shortcut was created to help out.

The Internet Shortcut / URL file (*.URL) is a windows file which can however be used on other OS or better stated by browsers on other OS other than Windows. This is used extensively in IE to store bookmarks and favorites but can also be used to create a double clickable file (shortcut) similar to a file shortcut rather pointing to an internet resource and recognized by all major browser.

The file format
The file format is similar to an INI file and has the .URL extension (note .url doesnít seem to work for some people but .URL works in all cases)


Code: [Select]
[InternetShortcut]
URL=http://www.example.com/index.php
Workingdirctory=c:\Windows\
ShowCommand=7
IconIndex=1
IconFile=c:\Windows\system\url.dll
.
.
.

There are still some other field but the most important are the URL, and ShowCommand field

URL: This is self-explanatory. It is the url of the internet resource. Note this is not limited to the http protocol, it can be http, https, ftp or some other supported protocols

ShowCommand: This the state the browser should be when the URL is opened. 0 or not setting this means normal, 3 means maximized, while 7 means minimized.

IconFile: This is the location of the file containing the icon that should be displayed for this file. This can be a .ico, .dll, .exe, or any file which can contain an icon file. Note that this is not limited to ffiles on the local machine of the user, it can be on your webserver e.g. IconFile=http://www.example.com/myicon.ico 

IconIndex: the index of the icon to use in the file specified in IconFile.


Benefits for generating this on the server side
Being able to generate this on the fly on the server side and letting the user download it their computer will be of great benefit in that

1. The user can save the file on their desktop like a file shortcut but pointing to your website
2. Your website is one click away from the user
3. The user donít have to remember your url to visit your site
4. The file can be shared with friends and is OS independent compared to the Mac OS / Safari .webloc counterpart

Generating on file from the server
The code below shows our to set the URL field (which is the only necessary and most important field to set) from the server side, preparing the file and shipping it to the user for download

Code: [Select]
<?php
    $protocol 
"http://";
    if (!empty(
$_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443)
    {
        
$protocol "https://";
    }
    
$shortText "[InternetShortcut]\nURL={$protocol}$_SERVER['SERVER_NAME'];
 
    
// We'll be outputting an internet shortcut file
    
header('Content-type: application/internet-shortcut');
 
    
// It will be called myShortCut.URL
    
header('Content-Disposition: attachment; filename="myShortCut.URL"');
 
    
//output URL file
    
echo $shortText;
 
?>


The mime (content-type) could be any of wwwserver/redirection, application/internet-shortcut, application/x-url, message/external-body, text/url, text/x-url but application/internet-shortcut works fine.



Nigeria Oil & Gas Forum

A shortcut for your website
« on: May 06, 2013, 04:04:22 PM »

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
527 Views
Last post May 29, 2015, 02:27:22 PM
by guagecon
0 Replies
438 Views
Last post July 01, 2015, 06:03:41 AM
by guagecon
0 Replies
525 Views
Last post July 14, 2015, 12:54:22 AM
by guagecon
0 Replies
476 Views
Last post January 24, 2016, 12:03:11 AM
by pintogen
0 Replies
554 Views
Last post January 29, 2016, 01:50:31 AM
by pintogen

Sponsored Ads

Quick Links

About Us
Contact us
Register
Privacy Policy

Contact Info

Nigeria Oil & Gas Forum

Email Address
info@oilandgasforum.com.ng
Contact Form
Business Hours
9.00am - 5.00pm (Mon - Sat)

Would you like to partner with us on this forum?

Then you can contact us here


Nairaland     Oil Prices     UK Gas Forum     Ghana Gas Forum     Russian Oil & Gas Forum     Israel Oil Forum     Agric Forum      freeslots.la

Powered by EzPortal