Welcome to WebmasterWorld Guest from 23.22.220.37

Forum Moderators: not2easy

Message Too Old, No Replies

syntax

     
4:51 pm on Mar 14, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member wilderness is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 11, 2001
posts:5408
votes: 2


Could somebody tell me if this CSS, Java or whatever?

$(document).ready(function(){
$(window.location.hash).append('<a name="' + window.location.hash.replace('#','')+ '"></a>');
window.location.href=window.location.href;
});

This is to allow page anchors to function within Firefox, in which it functions as intended.

My curiosity is precautionary as I'm also interested in knowing if the lines present a vulnerability for hijacking links?

TIA
5:55 pm on Mar 14, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Javascript.

Java is something entirely different.
6:00 pm on Mar 14, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member wilderness is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 11, 2001
posts:5408
votes: 2


fancy meeting you over here ;)

You think the use presents any vulnerabilities?

I've in excess of 200 pages with anchor links in the content and want to be sure before I add this to those page headers?
6:05 pm on Mar 14, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


The Javascript code runs entirely in the browser.
7:15 pm on Mar 14, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


Could somebody tell me if this CSS, Java or whatever?

For future reference: You can tell it isn't CSS because CSS performs no actions ("append", "replace" etc). It's purely presentational.

:: peering into crystal ball ::

g1 clicked View Unread Posts-- or local equivalent-- and caught the word "syntax" ;)
4:38 pm on Mar 15, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


<doesntreallyrequireanswer> I'm curious as to why you'd need to resort to Javascript to use page anchors. This bit of JS forces a refresh of your page, doesn't it? Anchors work fine in FF with just the id attribute (not NAME. Name is deprecated for non-form elements.) </doesntreallyrequireanswer>