Home > front end >  How can automatically remove the http://prefix will output the ASP web site?
How can automatically remove the http://prefix will output the ASP web site?

Time:11-05

ASP output url prefix automatically remove http://?
For example: & lt; Td bgcolor="# FFFFFF" & gt; <% %=url & gt;
<% %=url & gt; The output is displayed when a web site, such as & lt; % %=url & gt; The output is: https://www.baidu.com
I want is the effect of www.baidu.com, that is, to remove http://this prefix?
Just learning ASP, what also don't understand?
I hope teachers detailed answer, thank you!

CodePudding user response:

Write a method to replace the line, the front-end js or backend js,

Asp:
 
//call the place change to:
<% %=formatURL (url) & gt;

//any place with the back-end function code, simple copy for front end can also
<script language="javascript" runat="server" & gt;
The function formatURL (url) {
Reutrn (url | | ""). The replace (/^ HTTPS? : \ \///I, "");
}
</script>

CodePudding user response:

Don't work,

CodePudding user response:

<%=Split (url, "//") (1) % & gt;

CodePudding user response:

refer to the second floor of acacia ferry reply:
doesn't work,


The return type is wrong, check it yourself

CodePudding user response:

<% %=url & gt; Replace, instead & lt; %=Replace (url, "http://", "") % & gt;

CodePudding user response:

There must be one can all the ls method

CodePudding user response:

"Stick to the points, to mix a familiar face

CodePudding user response:

If you want to get is their own pages can be so & lt; %=Request. ServerVariable (" HTTP_HOST ") % & gt;
If the other is the string processing, there are a lot of functions can be done, mid, left, right, split, replace, etc., their learning under the headphones
  •  Tags:  
  • ASP
  • Related