Eric Durbin![]()
Creates a link that allows you to bookmark dynamic content from your website.
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script> function getDynamicValue() {
var dynamicArray = ['value1', 'value2', 'value3', 'value4'];
randomInt = Math.floor(Math.random() * 4);
return dynamicArray[randomInt];
}
//add permalink to page
YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.11.30-20-58'
}).use('gallery-permalink', function(Y) {
var linkGenerator = function() {
var base = window.location.href;
if (base.indexOf('?') != -1) {
base = base.substring( 0, base.indexOf('?') );
}
return base + "&dynamicValue=" + getDynamicValue();
}
var permalink = new Y.Permalink({
render: '#permalink',
linkGenerator: linkGenerator,
label: 'Bookmark Page',
left: 50,
top: 20
}
);
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info