Thursday, 15 March 2012

html - # character in path of javascript reference -


I have a web page that drags into several javascript files in the head section. The path is dynamically generated to one of those files, and I see a problem with some paths, which includes # characters For example, the following path does not resolve correctly, and therefore. The js file is not loaded (even if I have verified that it exists):

   

I am wondering what is the special meaning of '# 3' in this situation. I have tried changing the # character to the equivalent html unit, such as:

   

But this does not solve the problem. Besides, I have seen that the following path does resolve correctly (assuming the file):

  & lt; Script src = "\\ remote_machine \ share \ test \ this # test \ test.js" & gt; & Lt; / Script & gt;  

What is the meaning of '# 3' in the context of html as described? What is the recommended fix?

Edit: I have tried to replace "%" instead of '#' in the three examples above, the first two are broken, and the third does not work anymore. If I change all the places with 20% addition, then I get the same result.

In addition, hash and spaces (which respectively % 23 And should be encoded as % 20 ), you have also received a backslash. There are no directory separators in backslash URLs. A URL is not the same as a filename, and what you have found here is a file Not the name, it is a UNC path to the local area's Windows networking.

There is no standard way to embed a UNC path in the urc; Windows Networking has no place on the Web and you should not include references to resources on the Windows network in any Web page. If you want try:

  file: 

// remote_machine / share / test / this% 20is% 20% 23% 20test / Test.js # works on IE, chrome, opera file: ///// remote_matchin / share / trial / this% 20is% 20% 23%


No comments:

Post a Comment