I can use this jQuery code to dynamically change the RSS link in the DOM in Firefox & Chrome. http://path.com/feed is normally replaced by a variable, but not for this example.
$('#rssfeed').remove();
$('head').append('<link id="rssfeed" rel="alternate" type="application/rss+xml" href="http://path.com/feed"/>');
The live bookmark feature immediately updates. However, this doesn’t work in IE7.
In IE7 I have tried this method, also created an in the html and tried updating with .setAttribute(href,’path.com/feed’), and tried creating a new DOM element and attaching it to “<_head>” (no _ in the actual code, of course).
The only “success” I have had was doing a document.write. The big problem with this is that I can’t change it after the page has loaded.
Can anyone recommend an alternate way to change the link element href and have it dynamically reloaded by IE7? Alternatively, is there a way to force the browser to re-interpret or reload the DOM without doing a full page refresh?
Unfortunately, the short answers to your questions are “No” and “Sort of” because of a lack of browser support for udpating the list of feeds that are modified/added/removed in IE and Firefox.
First, in order to add elements to the document
HEADin IE (remember this applies to CSS as well), you must be sure to specify the first item in the array that is returned by jQuery’s element selector (note the use of the eq(index) selector):Note: I found including the
TITLEattribute made it easier to see the changes.While you can change the
HREFattribute of theLINKin both IE and Firefox (through the DOM), neither will update the RSS icon menu. However, you can addLINKelements and they will be recognized by the RSS icon menu but the old entries will remain because Firefox only builds that menu whenLINKs are added.See the following links for more information: