Solved

unexpect base tag behaviour

Posted on 2000-05-10
12
185 Views
Last Modified: 2012-05-04
I have a CGI that reads an HTML file (freqently not written inhouse) up to the browser via stdout. The problem is that for the resulting page a BASE is being set to the path of the cgi that's generating the display. This is causing links on the resulting page to no longer work.

Basically...

page 1 - has links of general form "cginame?inputArgs_out.htm"

this results in out.htm being written to the browser over stdout.

out.htm can have relative locations in it (both links, and graphics). I need for these  hrefs and img tags to work.

I'd like to avoid having to read all the links and insert the appropriate base in them (i.e. find <a href='2nd.htm'> and change it to <a href='www.dummy.com/2nd.htm'>.

Is there a way to do this?

As an aside, if I do a view source in Netscape 4.6 it appears as though a base tag has been dumped in for me.

Thnaks
0
Comment
Question by:winkle
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 8

Accepted Solution

by:
jbirk earned 200 total points
ID: 2798893
I believe just using:
<BASE HREF="www.dummy.com">
should work for you.  Did you say that it's already putting a line like that in there?  Did you write the cgi, or is it someone else's code, and do you have access to the cgi code?

-Josh
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2799139
how about just getting rid of the base  in the cgi-script?
0
 
LVL 4

Expert Comment

by:rafistern
ID: 2799723
or if you are working with some kind of tamplate, putting the <base> inside comments.
0
 

Author Comment

by:winkle
ID: 2800961
This extra base target is being generated by (I'm told by the person in charge fo the pages I'm working with) Netscape. I have no control over it. In other words, there is a base tag (that is being set to my cgi) that's being added by something OTHER than my cgi. What I've been told is that it is the browser that is adding it.

There have been cases where I've been able to add a base tag in the Head tag and the one I added overrode the one added by the browser. However, there was one case where added a proper base tag caused a problem. I'd like to know if I can turn this feature off.

0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2801314
You should talk with the programmer about that.
0
 

Author Comment

by:winkle
ID: 2801385
So the general answer is that the proper thing to do is to add a correct BASE tag to the HEAD tag of the web page I'm displaying? That should override the tag being put in by the browser?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:jbirk
ID: 2801410
Is your cgi-script outputing valid html?  In what circumstances exactly is it adding it's own base tag?  I haven't seen this behavior before so I'm curious.  Are you sure it's the clients browser, and not something else on the server perhaps?  Also, what base is getting set (where does the browser pick as it's base for the document)?

I think I remember seeing that if you choose to download for offline viewing, or something like that the browser would add a base tag, but that's the only circumstance that comes to mind right now...

-Josh
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2801423
My comment was being written when your last one came in winkle...  sorry about that.  To answer that last question, yes, I should think that specifically outputting that from your cgi-progam would fix the problem.

-Josh
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2844489
How's it coming on this winkle?  Did you figure it out?
0
 

Author Comment

by:winkle
ID: 2846868
Sorry, we lost internet access for a while.

Adding a base tag a the end of the generated head tag (It just didn't seem the optimum solution.) does appear to override the base tag being dropped in by the browser.

jbirk noted that this hadn't been seen before...I hadn't either, but in Netscape the extra tag is visible on the page generate by my cgi, if you do a view source on the generated page. It's in front of the first line of HTML that my cgi writes. I assume that IE is inserting it as well (though you don't see it when you view source) based on the behaviour.

I'm not sure how to close out this question since it seems to have been a discussion that led to agreement on my guess of how to deal with the situation was probably the best thing to do.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2847656
It's ultimately up to you who gets the points, but you should award them to someone (the person you feel helped you the most).  If you want to award points to a second expert for help on this question, open a second question titled "for expertname".(fill in expertname with the appropriate expert name of course:)

-Josh
0
 

Author Comment

by:winkle
ID: 2847674
Comment accepted as answer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apostophes in PHP generated form 6 39
HTML CSS 7 39
.php tree directory? 5 57
form button worked now it doesnt anymore 9 42
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now