Association Analysis of hash and ico in js, and jshashico Association
This article analyzes the relationship between hash and ico in js. Share it with you for your reference. The details are as follows:
A bug was proposed in a recent test, saying that the ico in several pages is not displayed, so we can troubleshoot the problem.
First, make sure that the link on the page has introduced favicon. ico. It is found that location. hash in js causes ico not to be displayed. The reason is that the ico is not displayed because location. hash is set when the ico is not loaded.
Location. hash is often used in projects and is used for url locating, for example, Zookeeper job-manage.pdf in http://h.liepin.com/?job-manage= ".
Solution ):
Project highlights:
1. The page content is sent by clicking menu;
2. The displayed content on the page is the default Click Event of a menu;
3. Set location. hash to a menu click event.
In this way, a problem exists. When the page is displayed, the menu click event is executed, and location. hash is set.
You can set a variable so that location. hash is not set when you enter the page.
$(function(){ $('.menu a').click(function(event,hashBoolean){ var that = $(this); $.ajax({ url:'', type:'GET', data:{}, cache:false, dataType:'json', success:function(data){ if(data.flag == 1){ if(!hashBoolean) location.hash = ['id',that.attr('data-id')].join('='); } } }); }); $('.menu a').eq(0).trigger('click',[true]);});
I hope this article will help you design javascript programs.