Sandip's Programming Zen

An attempt to share tech/coding experiences

Archive for the ‘Internet’ Category

Replacing “src” property using Javascript in embed tag

leave a comment »


If you try to replace the src property of embed tag using javascript , it will work fine in Firefox but not in IE.

To make it work in both you have to  wrap the embed tag in <div> and then replace the whole embed tag in div every time you want a change in src propert.


Written by Sandip

January 7, 2010 at 12:28 pm

Cross-Domain Calls with IFrames

with 2 comments

We know that cross domain ajax calls are not possible from javascript, but come’on we live in virtual world and every law can be bent if we can (remember Morpheus from ultra cool Matrix 😉 )

Ok, I found  here on this nice guy’s blog under Cross-Domain Communication with IFrames.

I have actually used it and it works like a charm. I made a simple javascript function to get the anchor values , actually I used anchors to pass values using URL as if passing URL variable.

For example if I want to pass one variable then I would do :

For two variables :

Two JS function, one for getting anchor value and second for resetting URL to it’s original form.

function getAnchor(name) {

url = window.location.href;
var varlen = name.length + 2;
var start = url.indexOf(“#” + name) + varlen;
var length = url.indexOf(“#”, start) – start;

var value = url.substr(start, length);
return value;

function resetAnchor() {
url = window.location.href;
var hash = url.indexOf(“#”)
if (hash >= 0) {
url = url.substr(0, hash);
window.location.href = url + “#”;

I would be happy to help if you have any troubles.

Written by Sandip

April 29, 2009 at 4:37 pm

Posted in Internet, Javascript

Tagged with ,

Maximize Firefox space for Gmail

leave a comment »

Gmail in Firefox is my primary work and personal email client, so I try to make as much space available as possible for Gmail.

I use Hide Menubar add-on which hides the main menubar, then I hide all other extra toolbars and keeping only Address bar (which minimum you need anyways).

Then, recently I found Gmail Compactor Add-On which make further space available for Gmail and make it look little better than standard interface. Make sure you have Greasemonkey add-on installed before you try.

Written by Sandip

April 29, 2009 at 4:10 pm

Posted in Internet, productivity

Tagged with , ,