hyperlink click event handler doesn't working on jquery 1.7.2 on google chrome version 37.0.2062.120 m
hello everyone,
i having problem on the new update of google chrome.
i have provide a small code you can try it
here
,
here is the code:
- $(function () {
- bindHyperlinks($('body'));
- });
-
- function bindHyperlinks(root) {
- root.find('a').click(function () {
- var url = $(this).attr('href');
- loadPage(url, function (html) {
- $('body').append(html);
- bindHyperlinks(html);
- });
- return false;
- });
- }
-
- function loadPage(url, cb) {
- var frame = $('<iframe />');
- frame.hide();
- $('body').append(frame);
- frame.load(function () {
- var content = $(this).contents().find('body').children();
- cb(content);
- frame.remove();
- });
- frame.attr('src', url);
- }
index.html
- <body>
- <a href="/test.html">Load page</a>
- </body>
test.html
- <body>
- <div>
- <a href="/test.html">Go to test</a>
- </div>
- </body>
so the idea of the code is whenever the link "Load page" clicked the test html page will be loaded using iframe then the children will be append on the body ofthe index.html, and the "Go to test" hyperlink will be below the "Load page" hyperlink.
the problem is when clicking Go to test, the process should be repeated to add the content of the test.html below the last hyperlink, but it fail on the latest google chrome update on version (version 37.0.2062.120 m).
i know it is google chrome related bug, but i can't wait for google to fix the bug and left my website error until it fixed.
any idea to fix this problem?
Best Regards
ktutnik