Posted by: prastut | जुलाई 4, 2007

Open the same post when clicked on Transliteration link.

Currently, when you click on a Transliteration link, it opens up the main blog link. I heard from one of the user that he wants to open the same post (that currently user is reading) when clicked on Transliteration link.

This is possible using a small Javascript. Here is how you do it using BlogSpot.

1) Click on Template -> Page Elements in your blogger menu. You will see following type of screen.

blogger_page_element.png

You should have one Page Element for Transliteration Links. Click to Edit the Element.

edit_page_element.png

Enter the following Code in the Edit Window and Save Changes. And test the code. Site [http://pranjalbhatt.blogspot.com/] is used here as example, but you can use your site address.

<script language="javascript">
<!--
function xliterate(obj)
{
var href = obj.href;
var ndx = href.indexOf(".xliterate");
if (ndx > 0)
href = href.substr(0, ndx + 11);
var host = location.hostname;
var path = location.pathname;
ndx = location.pathname.indexOf(".xliterate");
if (ndx > 0)
{
host = ''
path = location.pathname.substr(ndx+11);
}
var url = href + host + path;
//alert(url);
window.open(url, "bhomiyo");
return false;
}
//-->
</script>

<a href="http://bhomiyo.com/en.xliterate/pranjalbhatt.blogspot.com&#34; onclick="xliterate(this);return false;">Roman Hindi</a>

<a onclick="xliterate(this);return false;" href="http://bhomiyo.com/gu.xliterate/pranjalbhatt.blogspot.com">Gujarati</a&gt;

When you copy above code and paste it in your editor, make sure that all the html tags are intact and in correct syntax. You can copy and paste it to NOTEPAD first and then copy from NOTEPAD and paste it into other editor to avoid any errors. Specially there is issue with the quotes when WordPress renders it. So, be careful for quotes.

If you can’t get it working – send me an email (INFO at BHOMIYO dot COM) and I will send you this code file as attachment.


Responses

  1. The idea seems great. I will test it today🙂

  2. उक्त कोड सही कार्य नहीं कर रहा है. पेज नाट फ़ाउंड का एरर देता है. कृपया देखें.

    The code is updated again. — please check!

  3. I got the error in code. to correct the code pl REPLACE ” mark.

    It is working fine🙂

  4. Piyush ji
    I had sent an email to you that the code is not functioning. Ravi ji has found the error but where to replace the ” mark. Will you please correct it so that we may put it on our blog.

    Unmukta – I have sent you code as attachment. Let me know if you still have problem

  5. भाई जी

  6. यह कोड ठीक काम नही कर रहा एरर दे रहा है कृपया मदद करें।

    — I have again checked those quotes and changed them. It should be fine now.

  7. पियुष जी,

    आपसे एक सहायता चाहिये।
    क्या आप मुझे भोमियो की जावा स्क्रिप्ट अपने हिंदी टूलबार के लिये बना कर दे सकते हैं जिससे प्रयोगकर्ता एक क्लिक से जिस पेज पर हों उसी पेज की लिपि बदल सकें फिर चाहे उस पेज पर भोमियो का लिंक हो या न हो।

  8. sir i want english ti hindi convertor

  9. sir, how could i found d procedure to convert english to hindi & vice versa both. please help me…… will be thankful to u…………

  10. Handbook for application of plastic theory in design of steel structures

  11. really help full code, i am really appreciated you to share with us, i am glade to see


एक उत्तर दें

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / बदले )

Twitter picture

You are commenting using your Twitter account. Log Out / बदले )

Facebook photo

You are commenting using your Facebook account. Log Out / बदले )

Google+ photo

You are commenting using your Google+ account. Log Out / बदले )

Connecting to %s

श्रेणी

%d bloggers like this: