Connecting Tech Pros Worldwide Help | Site Map

InterPage Linking Problem in .mht file

  #1  
Old December 24th, 2008, 05:14 AM
Newbie
 
Join Date: Dec 2008
Posts: 2
Hello All,


I have created a .mht file in following format.

1. The .mht file contains following htmls.
a. MHTLinkingProblem.html
b. Left.html
c. Right.html
d. Start.html
e. Plus.gif

2. The MHTLinkingProblem.html is the main html which is divided in 2 frames.
3. The Start.html dummy html to display the start of the page
4. The Right.html contains :-
a. An image with a source attribute pointing to the content-id of the image embedded in the .mht file.
Code: - <img src="cid:plus.gif" alt="plus.gif">

b. And a anchor tag with a name attribute.
Code: - <a name="LinkName">

5. The Left.html contains two links to the Right.html. :-
a. <a href="cid:Right.html" target="Data">LinkWithoutFragmentRefURL</a>
b. <a href="cid:Right.html#LinkName" target="Data">LinkWithFragmentRefURL</a>


THE PROBLEM:-

The link shown in 5.b is not working. That is I am not able to refer a particular fragment of the html file using .mht. This is because the .mht resolve this URL in following format:-

cid:Right.html#LinkName

Now there is no content-id naming cid:Right.html#LinkName so it returns a error Page Cannot be displayed.


QUESTION:-

1. How to use the Relative Reference URL in the href attribute of the anchor tag so that it refers to a fragment(anchor tag with name attribute) of ANOTHER html in the same .mht file?

Copy the code and save it as <Test>.mht file.
CODE :-

Expand|Select|Wrap|Line Numbers
  1. From: Regression
  2. To: Regression-User
  3. Subject: Regression
  4. Message-ID: Regression.html
  5. Mime-Version: 1.0
  6. Content-Type: multipart/related; boundary="----------1234567890------00-----";
  7. type="text/html"
  8.  
  9. ------------1234567890------00-----
  10. Content-Type: text/html; charset="US-ASCII"    
  11.  
  12. <html>
  13.     <head>    
  14.         <title>MHTLinkingProblem</title>
  15.     </head>
  16.     <frameset cols="350,*">
  17.         <frame src="cid:Left.html" name="Navigation" scrolling="yes" noresize/>
  18.         <frame src="cid:Start.html" name="Data" scrolling="yes" noresize/>
  19.     <noframes>
  20.         <h1>Sorry, this browser does not support frames.</h1>
  21.     </noframes>
  22.     </frameset>
  23. </html>
  24.  
  25. ------------1234567890------00-----
  26. Content-Location: cid:Left.html
  27. Content-ID: Left.html
  28. Content-Type: text/html            
  29.  
  30. <html>
  31.     <head>
  32.         <title>Right</title>
  33.     </head>
  34.     <body>    
  35.         <ul>
  36.             <li><a href="cid:Right.html" target="Data">LinkWithoutFragmentRefURL</a></li>
  37.             <li><a href="cid:Right.html#LinkName" target="Data">LinkWithFragmentRefURL</a></li>
  38.         </ul>
  39.     </body>
  40. </html>
  41.  
  42. ------------1234567890------00-----
  43. Content-Location: cid:Right.html
  44. Content-ID: Right.html
  45. Content-Type: text/html            
  46.  
  47. <html>
  48.     <head>
  49.         <title>Left</title>
  50.     </head>
  51.     <body>
  52.         This is a Right Hand Side of Page.<br/>        
  53.         <br/>                
  54.         <IMG SRC="cid:plus.gif" ALT="plus.gif"></body>
  55.  
  56.         <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  57.         <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  58.  
  59.         <a name="LinkName"><b>This the Location where LinkWithFragmentRefURL should refer to.</b></a>                    
  60. </body>
  61. </html>
  62.  
  63. ------------1234567890------00-----
  64. Content-Location: cid:Start.html
  65. Content-ID: Start.html
  66. Content-Type: text/html            
  67.  
  68. <html>
  69.     <head>
  70.         <title>Left</title>
  71.     </head>
  72.     <body>
  73.         This is a Starting Page.
  74.     </body>
  75. </html>
  76.  
  77. ------------1234567890------00-----
  78. Content-Type: image/gif
  79. Content-ID: plus.gif
  80. Content-Transfer-Encoding: base64
  81. Content-Disposition: inline; filename="plus.gif"
  82.  
  83.  
  84. R0lGODlhEAAQAKIAAMDAwICAgACAgAAA/wAAAP///wAAAAAAACH5BAUUAAUALAAAAAAQABAAAANC
  85. WLpFxHC5MV5Uk1LLstZcIwBfyRHDWH4WmpLr1mhq7LhUDRJCMNMwx6iH+QiEgKRDAholAcvO5hmN
  86. oHjVSyOr7SoSADs=
  87.  
  88. ------------1234567890------00-------

Last edited by eWish; December 25th, 2008 at 02:48 AM. Reason: Please use the code tags
  #2  
Old December 27th, 2008, 02:45 PM
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,543

re: InterPage Linking Problem in .mht file


I am not trying to feign ignorance, but what is a ".mht" file? Is this something specific to a program? If so, is this a problem with that program or with HTML itself?

I ask as this is an HTML forum, not a forum for a specific program and I would have to move this thread to the miscellaneous forum.

Regards,

Jeff
  #3  
Old December 28th, 2008, 03:35 PM
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 901

re: InterPage Linking Problem in .mht file


@Jeff - .mht is a Microsoft thing.

--Kevin
  #4  
Old December 28th, 2008, 04:11 PM
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,520

re: InterPage Linking Problem in .mht file


Yes, it's an archiving file. Firefox has an extension, and 'nix has programs, that can read/write these so I find it useful to save pages that contain graphics and running javascript.
  #5  
Old December 29th, 2008, 05:02 AM
Newbie
 
Join Date: Dec 2008
Posts: 2

re: InterPage Linking Problem in .mht file


Hello all,

Thanks everyone for the reply.

I am checking the replies today.

.mht helps bundle multiple files such as hmtl/CSS/Images/JavaScript to one single file, exactly as the "Kevin" above has posted.

The problem is at its core is an html relative linking within pages.

1.For example, I have a page Left.html has a relative hyper linking within the some other page Right.html#LinkName.All these linking are working as an individual html files but when I combine all the html files to single .mht file the links with

Expand|Select|Wrap|Line Numbers
  1. <a href="cid:Right.html#LinkName" target="Data">LinkWithFragmentRefURL</a> 
Show the error on the page. But the link

Expand|Select|Wrap|Line Numbers
  1. <a href="cid:Right.html" target="Data">LinkWithoutFragmentRefURL</a> 
Works fine.


2.From the .mht point of view, if I Try navigating to the 2nd link from another page (Right.html), I get an error. But navigating to the 2nd link from the same page (Left.html) is no problem i.e. checking on the link form the same page.

Regards
Naveen Murthy

Copy pase the code and save it as <Test.mht>

Code:-

Expand|Select|Wrap|Line Numbers
  1. From: Regression
  2. To: Regression-User
  3. Subject: Regression
  4. Message-ID: Regression.html
  5. Mime-Version: 1.0
  6. AbsoluteURI: "thismessage:/"
  7. Content-Type: multipart/related; boundary="----------1234567890------00-----";
  8. type="text/html"
  9.  
  10. ------------1234567890------00-----
  11. Content-Type: text/html; charset="US-ASCII"    
  12.  
  13. <html>
  14.     <head>    
  15.         <title>MHTLinkingProblem</title>
  16.     </head>
  17.     <frameset cols="350,*">
  18.         <frame src="file://c:/Left.html" name="Navigation" scrolling="yes" noresize/>
  19.         <frame src="cid:Start.html" name="Data" scrolling="yes" noresize/>
  20.     <noframes>
  21.         <h1>Sorry, this browser does not support frames.</h1>
  22.     </noframes>
  23.     </frameset>
  24. </html>
  25.  
  26. ------------1234567890------00-----
  27. Content-Location: file://c:/Left.html
  28. <!-- Content-ID: Left.html -->
  29. Content-Type:text/html;
  30.  
  31.  
  32. <html>
  33.     <head>
  34.         <title>Right</title>
  35.     </head>
  36.     <body>    
  37.         <ul>
  38.             <li><a href="cid:Right" target="Data">LinkWithoutFragmentRefURL</a></li>            
  39.             <li><a href="cid:Right#LinkName" target="Data">LinkWithFragmentRefURL</a></li> <!-- mhtml:file://C:\Documents%20and%20Settings\nam1cob\Desktop\MHTLinkingProblem.mht! -->
  40.  
  41.         </ul>
  42.     </body>
  43. </html>
  44.  
  45. ------------1234567890------00-----
  46. Content-Location: file://c:/Right.html
  47. Content-ID: Right
  48. Content-Type:  text/html            
  49.  
  50. <html>
  51.     <head>
  52.         <title>Left</title>
  53.     </head>
  54.     <body>
  55.         This is a Right Hand Side of Page.<br/>        
  56.         <br/>                
  57.         <IMG SRC="cid:plus.gif" ALT="plus.gif"></body>
  58.         <!-- Please dont delete these br. These are required. -->
  59.         <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  60.         <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  61.  
  62.  
  63.  
  64.         <a name="LinkName"><b>This the Location where LinkWithFragmentRefURL should refer to.</b></a>                        
  65.  
  66.     </body>
  67. </html>
  68.  
  69. ------------1234567890------00-----
  70. Content-Location: cid:Start.html
  71. Content-ID: Start.html
  72. Content-Type: text/html            
  73.  
  74. <html>
  75.     <head>
  76.         <title>Left</title>
  77.     </head>
  78.     <body>
  79.         This is a Starting Page.
  80.     </body>
  81. </html>
  82.  
  83. ------------1234567890------00-----
  84. Content-Type: image/gif
  85. Content-ID: plus.gif
  86. Content-Transfer-Encoding: base64
  87. Content-Disposition: inline; filename="plus.gif"
  88.  
  89.  
  90. R0lGODlhEAAQAKIAAMDAwICAgACAgAAA/wAAAP///wAAAAAAACH5BAUUAAUALAAAAAAQABAAAANC
  91. WLpFxHC5MV5Uk1LLstZcIwBfyRHDWH4WmpLr1mhq7LhUDRJCMNMwx6iH+QiEgKRDAholAcvO5hmN
  92. oHjVSyOr7SoSADs=
  93.  
  94. ------------1234567890------00-------

Last edited by eWish; December 29th, 2008 at 06:30 AM. Reason: Please use the code tags
Reply