473,715 Members | 3,751 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 8561
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
6160
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
1467
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
4498
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
2373
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
5073
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
4770
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
2533
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
1008
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
5584
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
8821
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
8718
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9340
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
9196
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...
1
9103
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5967
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
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.