<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8211560\x26blogName\x3dTech+Tips,+Tricks+%26+Trivia\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://mvark.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://mvark.blogspot.com/\x26vt\x3d-5147029996388199615', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Tech Tips, Tricks & Trivia

by 'Anil' Radhakrishna
An architect's notes, experiments, discoveries and annotated bookmarks.

Search from over a hundred HOW TO articles, Tips and Tricks


HOW TO link directly to a certain part of a web page that you don't own

This trick works only if the HTML container of the portion of the web page that you wish to link to has an ID attribute.

Generally, "named anchors" can be coded to allow jumping to links within the same page when you own those pages.

Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.

The upcoming HTML5 standard suggests using the id attribute instead of the name attribute for specifying the name of an anchor. Using the id attribute actually works also for HTML4 in all modern browsers.

Now what if you were reading an long article on a site you don't own & wanted your friend to read only a specific portion that's interesting. As I discovered from this answer on the WebApps StackExchange forum, you can append the "id" of the HTML element that contains the interesting portion to the URL after preceding it with a hash.

This trick assumes that the portion of the page that's of interest is within a HTML element like p(ara) or div tag and is uniquely identified through an ID attribute. To check this, you have to scan the HTML source (Developer tools that come natively with browsers or Firebug or the View Selected Source option in Firefox can let you easily jump to a specific element) of the webpage that you want to link to and see if the container of interesting material has an ID

Let us say, I wanted to share a link that specifically explains what a "Fold-in" is. Rather than share the link to the Wikipedia article (http://en.wikipedia.org/wiki/Al_Jaffee) about the inventor of the "Fold-in", Al Jaffee, I can directly send you to the description of the "Fold-in" within that article -
http://en.wikipedia.org/wiki/Al_Jaffee#The_Fold-In

Labels: ,

Tweet this | Google+ it | Share on FB

« Home | Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »

»

Post a Comment