I have a link in the page.On clicking the link the pop up should render with required url.I have the window.open code as follows
Click here
on clicking above link the popup is opening with url upto http://astrik.com/click?id=613*B and offerValue is not showing up in the url of pop up.I need the offerValue to be shown in the url.Any reason for not showing up the offerValue.
The provided URL contains a ? that indicates the start of an argument list. Each argument is separated by an &. Thus, for the parser the provided argument list look like this:
name=aravind, age=19, url=http://astrik.com/click?id=613*B and offerValue=2.9. They all belong to the request to /action.do.
You need to escape the last amp with its URL escape code %26 like this:
/action.do?name=aravind&age=19&url=http://astrik.com/click?id=613*B%26offerValue=2.9
to "bind" the last argument to the astrik URL. Maybe it is also required to escape the second ? with %3F.
You should escape the data parts in url's before using it. In this case the data part url is bugged by the ampersand(&) in the url.
var url = encodeURIComponent('http://astrik.com/click?id=613*B&offerValue=2.9');
Click here
(or just replace the ampersand, not sure now)
Try the following:
Click here
You must URL encode your parameters for the "url" value, otherwise they will get appended to the original URL.
Related
When the bookmarklet is clicked, I need the URL, such as this:
https://example.com/test/page1/page2/page3/final page
To be replaced with:
https://example.com/panel/pages/test+page1+page2+page3+final-page
If it isn't clear, the domain remains the same, but then after it is /panel/pages/, followed by the same original page structure, but with + instead of /. Finally, if final page has a space (not all of them do), a - is used.
Not every URL I want this for has three pages before the final one. Some have just one or two. So, it would need to apply to all of them somehow.
The idea here is that the second link is used for editing the page, and the first is the live page. I want an easy way to open the page for editing. Ideally, the new URL would open in a new tab.
I'd love some direction, considering I'm a total newb at this.
How about this?
(function(loc) {
loc.href = `${loc.protocol}//${loc.host}/panel/pages/${
loc
.pathname
.slice(1)
.replace(/\//g, "+")
.replace(/(\s|%20)/g, "-")
}`;
})(window.location)
This creates a redirect to...
protocol is http: or https:
Adding // in between the domain and host
The page host name
We go to the hardcoded /panel/pages/
loc.pathname gets everything including and after the / in the URL
Because it includes the leading /, we must remove it so it does not become + as well with .slice(1)
Then we replace all /s with +
Replace all spaces (in the URL it's encoded as %20)
Bookmarklet-ready code:
javascript:(function(l){l.href=`${l.protocol}//${l.host}/panel/pages/${l.pathname.slice(1).replace(/\//g,"+").replace(/%20/g,"-")}`})(window.location)
I have defined an Action on my Textbox to Go to an URL. For that I have used Go to URL in Action. URL is coming from a field value in my database. Below is my code in the Expr.
"javascript:void(window.open('"+Field!urlfield.Value+"'))"
My URLs sometimes have %5c, %20, %40 in them, when i used Go to URL action with Javascript,the URLs are missing these characters so the link does not open. When i use it without Javascript, URL opens but in the same page as the report. Users want the report to be opened in new tab/window.
I tried Encoding/Decoding URL by adding system.web reference to my report to use function encodeuri & decodeuri as described in the link http://capstonebi.blogspot.com/2010/04/url-encoding-in-reporting-services.html
Public Function URLEncode (ByVal inURL As String) As String
Dim outURL As String
outURL = System.Web.HttpUtility.UrlEncode(inURL).ToString
Return outURL
End Function
Function Decode(ByVal EncodedString AS String) AS String
Return System.Web.HttpUtility.HTMLDecode(EncodedString)
End Function
I expected the link will be decoded and then passing it to encoding string as input to Javascript.void.window will resolve missing characters but it is still the same.
Question:
1. Is there any other way to open the link in new window (Other than ctrl+click).
2. If not, how can i resolve missing the URL characters.
I wanted to navigate to a URL using queryParams while Routing in Angular.
<a routerLink='/master' [queryParams]="{query:'%US',mode:'text'}"><li (click)="search()">Search</li></a>
The URL I wanted to navigate is:
http://localhost:4200/master?query=%US&mode=text
But when I click on search it navigates me to:
http://localhost:4200/master?query=%25US&mode=text
I do not know why 25 is appended after the % symbol. Can anyone tell me a cleaner way to navigate correctly.
In URLs, the percent sign has special meaning and is used to encode special characters. For example, = is encoded as %3D.
Certain special characters are not allowed in url. If you want to use those in url you have to encode them using encodeURIComponent javascript function.
%25 is actually encoded version of % character. Here browser is encoding them itself.
When trying to get queryParams from url , you can decode them using decodeURIComponent.
For more information check : https://support.microsoft.com/en-in/help/969869/certain-special-characters-are-not-allowed-in-the-url-entered-into-the
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent
I would like to get all the links from a page, which match on a specific pattern.
I try to do this with Regular Expression Extractor post processor with regex like this: <a[^>]* href="([^"]*)".
I checked response of GET command and found, those links are not visible in response, but links are only visible in browser, when mouse is over text.
Don't use regular expressions to parse HTML data.
I would recommend going for CSS/JQuery Extractor instead, the relevant configuration would be something like:
Reference Name: anything meaningful, i.e. link
CSS/JQuery Expression: a
Attribute: href
Match No: -1
You will be able to see all the extracted link URLs using Debug Sampler and View Results Tree listener combination. See How to Use the CSS/JQuery Extractor in JMeter article for more details.
In general when mouse is over text the attribute title is used for the text
So in your case if title is after href you the following (group 2 for mouse over text)
<a[^>]* href="([^"]*)" title="([^"]*)"
and change Template to use second group as $2$
I have a field in a notesdocument containing a path to a database using backslases (i.e Folder1\Folder2\start.nsf)
and I am trying to redirect users when clicking a div with the following client side code
location.href= "#{javascript:dbdoc.getItemValueString('DatabasePath')}"
but the back slases are not returned , all I get is a string with all the folders without slashes so the url do not work
how can I escape the path correctly so that the link works?
Thanks
Thomas
Use JavaScript's escape function:
location.href= "#{javascript:escape(dbdoc.getItemValueString('DatabasePath'))}"