Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

transforming (ajaxifying) A HREF results in faulty behavior

more options

Hi.

I'm very happy that the HTML5 History API now allows me to change the address bar (before # char) without doing a roundtrip to the server (and thus flicker the user's screen)..

I've implemented this on my new site, test url at http://skatescene.biz/elections (on an ADSL line, bit slow).

In order for search engines to spider my content, I'm sending from PHP all internal links as <a href="/path/to/content">, then using javascript on window.load to transform/ajaxify them to href="javascript:window.History.pushState(null, 'pageTitle', '/path/to/content');

Chrome has no problems with this at all, and Firefox has no problems if those transformed URLs are eval()-ed (which my opensource animated button and menu components do).

However, a completely normal <A HREF=""> in my content, for instance the link to "democratic party" in the content of http://skatescene.biz/elections, will in FireFox (latest version) give me a blank page with "true" on it, and in the address bar the transformed link (javascript:window.History....)

I have been unable to find a work-around for this firefox bug. Or maybe i'm doing something wrong. If you have any tips for me, please let me know.

P.S. the CODE for that site is opensourced, as thanks for the many opensource tools I use myself.. It even includes HTML+JSON caching of many pages of content for lightning fast browsing within the site :) See http://mediabeez.ws/blog/html5-history-plus-caching

Hi. I'm very happy that the HTML5 History API now allows me to change the address bar (before # char) without doing a roundtrip to the server (and thus flicker the user's screen).. I've implemented this on my new site, test url at http://skatescene.biz/elections (on an ADSL line, bit slow). In order for search engines to spider my content, I'm sending from PHP all internal links as <a href="/path/to/content">, then using javascript on window.load to transform/ajaxify them to href="javascript:window.History.pushState(null, 'pageTitle', '/path/to/content'); Chrome has no problems with this at all, and Firefox has no problems if those transformed URLs are eval()-ed (which my opensource animated button and menu components do). However, a completely normal <A HREF=""> in my content, for instance the link to "democratic party" in the content of http://skatescene.biz/elections, will in FireFox (latest version) give me a blank page with "true" on it, and in the address bar the transformed link (javascript:window.History....) I have been unable to find a work-around for this firefox bug. Or maybe i'm doing something wrong. If you have any tips for me, please let me know. P.S. the CODE for that site is opensourced, as thanks for the many opensource tools I use myself.. It even includes HTML+JSON caching of many pages of content for lightning fast browsing within the site :) See http://mediabeez.ws/blog/html5-history-plus-caching

All Replies (3)

more options

A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.

The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.

more options

Thanks, cor-el. I posted it there and am waiting for the mods to OK my post.

This morning, I also tried .addEventListener() and .onClick="myJavascript; return false;" (demo of problem updated) but neither works, in Chrome nor FireFox :((((((

more options