Hi, I have a lot of documents that have a mix of absolute and relative
links. I'm using the following code to add the full URL and make the
links all absolute. It works for the links that are relative, but it
also puts the full URL in front of the links that are already
absolute, making them break. How can I edit this code to only add to
the links that are relative and leave those that are absolute alone?
Another thought I had was to first take out the domain, and then run
the script for everything, but I'm not sure how to do that. Also, the
pages in my array have parameters that come after them, so I can't
simply replace those with the full URL, I have to add the domain in
front of what is there.

Thanks for your help.

function fixHrefSrc() {
    var mb_jsp_pages=new Array("email-colleague.jsp", "events.jsp",
"events-more.jsp", "lobby.jsp", "showdctmdoc", "getdoc" )
        for (r=0;r<mb_jsp_pages.length;r++) {

                $('[EMAIL PROTECTED]"'+ mb_jsp_pages[r] +'"]').each(function() {
                        $(this).attr('href', 'http//myfullurl/folder/'+($
(this).attr('href')));
                        $(this).attr('target', '_blank');
                });

                $('[EMAIL PROTECTED]"'+ mb_jsp_pages[r] +'"]').each(function() {
                        $(this).attr('src', 'http//myfullurl/folder/'+($
(this).attr('src')));
                });
        }
}

Reply via email to