473,769 Members | 3,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save a web page - hyperlinks question

I would like to save a web page to a file and have the hyperlinks work
when I bring the file back up. If the web page has a hyperlink like the
following
<a href="OurWeb/News/abcFile.htm">, after saving the file and showing
it on the screen, and you try to click on the link, it will try to go
to C:\OurWeb\News\ abcFile.htm instead of
www.MyWebSite.com/OurWeb/News/abcFile.htm.
If I am on the website www.MyWebSite.com, and do "File" - "Save As" and
under "Save as Type" select "Web Page, complete (*.htm,*.html)" , it
will save the hyperlink as www.MyWebSite.com/OurWeb/News/abcFile.htm.

How can I programmaticall y do "File" - "Save As" and under "Save as
Type" select "Web Page, complete (*.htm,*.html)" ? Thank you.

This is how I save the web page:
WebBrowser1.Exe cWB OLECMDID_SAVEAS , OLECMDEXECOPT_D ONTPROMPTUSER,
"c:\abc.htm ", null

OR

Set fs = CreateObject("S cripting.FileSy stemObject")
Set filePtr = fs.CreateTextFi le("c:\abc.htm" , True)
filePtr.WriteLi ne (WebBrowser1.Do cument.body.inn erHTML)

Aug 26 '06 #1
3 8562
Jay
Well in the pages. why dont you just set a base "href" at the top of each
HTML document
add this tag above body tag:

<base href="http://www.MyWebSite.c om/">
that will then make all links and images on that site start
there.......unl ess previously defined.

Example 1:

This example will open a link from your computer to your website by default:
Notice i predefined the http://www. for every link and image.

<html>
<head>
<title>My Web Site</title>
</head>
<base href="http://www.MyWebSite.c om/">
<body>
<a href="OurWeb/News/abcFile.htm">My Web Site</a>
</body>
</html>

Example 2:

This example will open a link from your computer to where ever you
determine:
Notice the http://www. in it?

<html>
<head>
<title>My Web Site</title>
</head>
<base href="http://www.MyWebSite.c om/">
<body>
<a href=http://www.google.com> Google</a>
</body>
</html>

i dont think i worded this the best, hopefully you get what i mean. LOL.

Jay

<fi**********@g mail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
>I would like to save a web page to a file and have the hyperlinks work
when I bring the file back up. If the web page has a hyperlink like the
following
<a href="OurWeb/News/abcFile.htm">, after saving the file and showing
it on the screen, and you try to click on the link, it will try to go
to C:\OurWeb\News\ abcFile.htm instead of
www.MyWebSite.com/OurWeb/News/abcFile.htm.
If I am on the website www.MyWebSite.com, and do "File" - "Save As" and
under "Save as Type" select "Web Page, complete (*.htm,*.html)" , it
will save the hyperlink as www.MyWebSite.com/OurWeb/News/abcFile.htm.

How can I programmaticall y do "File" - "Save As" and under "Save as
Type" select "Web Page, complete (*.htm,*.html)" ? Thank you.

This is how I save the web page:
WebBrowser1.Exe cWB OLECMDID_SAVEAS , OLECMDEXECOPT_D ONTPROMPTUSER,
"c:\abc.htm ", null

OR

Set fs = CreateObject("S cripting.FileSy stemObject")
Set filePtr = fs.CreateTextFi le("c:\abc.htm" , True)
filePtr.WriteLi ne (WebBrowser1.Do cument.body.inn erHTML)

Aug 26 '06 #2
Thank you.
The problem is, I am saving the file using either the following method:

WebBrowser1.Exe cWB OLECMDID_SAVEAS , OLECMDEXECOPT_D ONTPROMPTUSER,
"c:\abc.htm ", null
OR
Set fs = CreateObject("S cripting.FileSy stemObject")
Set filePtr = fs.CreateTextFi le("c:\abc.htm" , True)
filePtr.WriteLi ne (WebBrowser1.Do cument.body.inn erHTML)

Does it mean, that after I save the file, I need to alter it to include
<base href="http://www.MyWebSite.c om/"?
Or, is there any way to save it with <base
href="http://www.MyWebSite.c om/">
in it ?

Thanks again.
Jay wrote:
Well in the pages. why dont you just set a base "href" at the top of each
HTML document
add this tag above body tag:

<base href="http://www.MyWebSite.c om/">
that will then make all links and images on that site start
there.......unl ess previously defined.

Example 1:

This example will open a link from your computer to your website by default:
Notice i predefined the http://www. for every link and image.

<html>
<head>
<title>My Web Site</title>
</head>
<base href="http://www.MyWebSite.c om/">
<body>
<a href="OurWeb/News/abcFile.htm">My Web Site</a>
</body>
</html>

Example 2:

This example will open a link from your computer to where ever you
determine:
Notice the http://www. in it?

<html>
<head>
<title>My Web Site</title>
</head>
<base href="http://www.MyWebSite.c om/">
<body>
<a href=http://www.google.com> Google</a>
</body>
</html>

i dont think i worded this the best, hopefully you get what i mean. LOL.

Jay

<fi**********@g mail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I would like to save a web page to a file and have the hyperlinks work
when I bring the file back up. If the web page has a hyperlink like the
following
<a href="OurWeb/News/abcFile.htm">, after saving the file and showing
it on the screen, and you try to click on the link, it will try to go
to C:\OurWeb\News\ abcFile.htm instead of
www.MyWebSite.com/OurWeb/News/abcFile.htm.
If I am on the website www.MyWebSite.com, and do "File" - "Save As" and
under "Save as Type" select "Web Page, complete (*.htm,*.html)" , it
will save the hyperlink as www.MyWebSite.com/OurWeb/News/abcFile.htm.

How can I programmaticall y do "File" - "Save As" and under "Save as
Type" select "Web Page, complete (*.htm,*.html)" ? Thank you.

This is how I save the web page:
WebBrowser1.Exe cWB OLECMDID_SAVEAS , OLECMDEXECOPT_D ONTPROMPTUSER,
"c:\abc.htm ", null

OR

Set fs = CreateObject("S cripting.FileSy stemObject")
Set filePtr = fs.CreateTextFi le("c:\abc.htm" , True)
filePtr.WriteLi ne (WebBrowser1.Do cument.body.inn erHTML)
Aug 26 '06 #3
Use this to obtain the content of the web page you are saving:
http://www.aspfaq.com/show.asp?id=2173
and then Scripting.FileS ystemObject to write the responsetext to a
file.

--
Mike Brind

fi**********@gm ail.com wrote:
Thank you.
The problem is, I am saving the file using either the following method:

WebBrowser1.Exe cWB OLECMDID_SAVEAS , OLECMDEXECOPT_D ONTPROMPTUSER,
"c:\abc.htm ", null
OR
Set fs = CreateObject("S cripting.FileSy stemObject")
Set filePtr = fs.CreateTextFi le("c:\abc.htm" , True)
filePtr.WriteLi ne (WebBrowser1.Do cument.body.inn erHTML)

Does it mean, that after I save the file, I need to alter it to include
<base href="http://www.MyWebSite.c om/"?
Or, is there any way to save it with <base
href="http://www.MyWebSite.c om/">
in it ?

Thanks again.
Jay wrote:
Well in the pages. why dont you just set a base "href" at the top of each
HTML document
add this tag above body tag:

<base href="http://www.MyWebSite.c om/">
that will then make all links and images on that site start
there.......unl ess previously defined.

Example 1:

This example will open a link from your computer to your website by default:
Notice i predefined the http://www. for every link and image.

<html>
<head>
<title>My Web Site</title>
</head>
<base href="http://www.MyWebSite.c om/">
<body>
<a href="OurWeb/News/abcFile.htm">My Web Site</a>
</body>
</html>

Example 2:

This example will open a link from your computer to where ever you
determine:
Notice the http://www. in it?

<html>
<head>
<title>My Web Site</title>
</head>
<base href="http://www.MyWebSite.c om/">
<body>
<a href=http://www.google.com> Google</a>
</body>
</html>

i dont think i worded this the best, hopefully you get what i mean. LOL.

Jay

<fi**********@g mail.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
>I would like to save a web page to a file and have the hyperlinks work
when I bring the file back up. If the web page has a hyperlink like the
following
<a href="OurWeb/News/abcFile.htm">, after saving the file and showing
it on the screen, and you try to click on the link, it will try to go
to C:\OurWeb\News\ abcFile.htm instead of
www.MyWebSite.com/OurWeb/News/abcFile.htm.
If I am on the website www.MyWebSite.com, and do "File" - "Save As" and
under "Save as Type" select "Web Page, complete (*.htm,*.html)" , it
will save the hyperlink as www.MyWebSite.com/OurWeb/News/abcFile.htm.
>
How can I programmaticall y do "File" - "Save As" and under "Save as
Type" select "Web Page, complete (*.htm,*.html)" ? Thank you.
>
This is how I save the web page:
WebBrowser1.Exe cWB OLECMDID_SAVEAS , OLECMDEXECOPT_D ONTPROMPTUSER,
"c:\abc.htm ", null
>
OR
>
Set fs = CreateObject("S cripting.FileSy stemObject")
Set filePtr = fs.CreateTextFi le("c:\abc.htm" , True)
filePtr.WriteLi ne (WebBrowser1.Do cument.body.inn erHTML)
>
Aug 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6162
by: scoop_77 | last post by:
I'm looking for some software that would allow me to point to a folder in Windows Explorer, and have it output an html file with hyperlinks to all of the files within that folder and all of the sub-folders. I have many folders with several dozen files and sub-folders and would like to avoid hand-coding all of the hyperlinks. Does anyone know if such software exists? Thanks in advance.
3
1473
by: Aasp | last post by:
Hello! I'm a complete Javascript newbie and my question is surely very naive, but believe me, I've spent this whole day searching thru the net and didn't find any solution to my little problem. So it goes: I don't know how to set the style (bold, italic, underlined) to all hyperlinks on a page. I know how to get one like this, but I mean all of them by default, I mean I downloaded a Javascript script from the net, a simple search...
9
4500
by: Marco Krechting | last post by:
Hi All, I have a page with a list of hyperlinks. I want to save information in a cookie about the fact that I entered an hyperlink or not. When I click one of the hyperlinks I want this stored in a cookie and a small bullit shown in front of the hyperlink, so when I reload the page I can immediately see which hyperlinks I already visited that day.
1
2376
by: Robin | last post by:
Hello! I'm having trouble with links and hyperlinks in MS Access 2003 - any help would be great! Question 1! The "insert hyperlink" icon opens a browser window, allows the user to browse to the desired file and paste the hyperlink on the form (which obviously remains for on all the records). I am trying to create a
6
5123
by: divya | last post by:
I have a page name edit.asp which should expire immediately .The user cannot open this page directly he has to provide a password for entering this page.thus when the user enters edit.asp , it has a button EDIT ,which when user clicks directs him to another page (done.asp). Now the problem is that from this page (done.asp) if he clicks on the back button on the toolbar then edit.asp opens.But I don't want it to open It should show page...
12
4775
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page on the client's computer? He/she could do this using the browser (file/save), but I need to have it done by pressing the pushbutton. In my serverside code I get the button-click-event, I also know how to get
17
2541
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this website. When I click in Google on one of these pages (not index.html or home.html), I am only linked to that one html-page and not to the website itself. Does anyone know how to fix this. Is there for example a metatag? Thanks
1
1009
by: Anjan Kumar | last post by:
I have a application which has a masterpage. And in the above out of the contentplace holder there are some asp buttons and in the left side there are some hyperlinks. Now the question is how I can; after clicking each buttons the text of the hyperlinks are being changed dynamically and after clicking the hyperlink the page is being navigate through. Can anyone help me out. I am suffering a lot for this but I cannot come out from this problem...
12
5591
by: Frustratee | last post by:
Sorry guys, this is killing me. I have been fighting this issue for several weeks, to no avail. I am exporting the results of a query to an excel sheet, with one of the columns being from a field of hyperlinks that link to files on the shared drive. I CANNOT get the hyperlinks to be assigned. I can change the field name, but not the hyperlink address. Can't figure it out. 1) I have a header row 2) Column 16 is where the hyperlinks are...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8861
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.