Is it possible to do something like the URL below?
myurl.co.uk/#myAnchor?myQry=this
I'm trying to pass tracking codes while also being able to have multiple links from an email go to relevant parts of my page.
This currently seems to do nothing as it is. Is it actually possible.
The query goes before the anchor, so:
http://example.com/page.php?parameter=value#anchor
Though the query always comes before any anchors, here is the solution for this if required.
One solution for this could be to use Apache HTACCESS and declare #myAnchor in rewrite rules. Then you can use something like this:
myurl.co.uk/#myAnchor?myQry=this
But please remember that in the htaccess the # is also used for commenting so you will have to escape it with a rewrite rule.
Related
I'm trying to find a specific link from a web page using windows command line and tools. I think Xidel can do what I want to do.
In the page, the link is used like this:
file: 'http://link.link/index.txt'
Note: there's only one line like this. Now if I can set something like
file: '{%link}'
then I'll be able to extract the link. Also if I want to change the word index.txt to something like root.txt and then use aria2 to download the link as http://link.link/root.txt , what do I need to do?
(I don't have any experience with any of these tools/command like scripts, I just wanted to make something that does this (some alternatives are already available but I want to do it myself) and this only. So I did search for it and have an idea on how can I do it but extrating the exact url seems to be the hardest part since I couldn't find anything that might help me in xidel's docs)
Xidel is meant to extract data from HTML/XML/json files, but it can also extract from CSV's and TXT if you know how to use the $raw variable and xidel/xquery functions, like extract(), tokenize() and replace().
Post the URL or the source (or part thereof) of the webpage and I'll see how I can help you.
In my header and footer template I have links like /pagina/test.
This works, but on other pages Bolt generates links like pagina/pagina/test. What am I doing wrong here?
To prevent wrong links I type in the whole url now www.test.nl/pagina/test, but this is not an ideal situation.
Normally I 'd say that you'd forgotten the first slash, but since you've specifically stated that you put that one in...
Could you post a more complete chunk of code?
I am deploying an app that is designed to run on the root and the html pages have a lot of links in the form:
/something/file.ext
like
/img/logo.png
/css/main.css
/js/app.js
and links too:
/link/to/url
I need to change them all into:
/subfolder/link/to/url
Is there any elegant way to do this without going page by page and changing it by hand?
I used Apache RewriteBase and HTML's base element..
I also read this question and answer which suggests what I'm doing should work:
Change BASE HREF for absolute references?
But it does not work!
I am doing this:
<base href="http://somesitename.com/subfoldername">
What happens is that the links still go to http://somesitename.com/url instead of the desired result.
The best solution I was able to come up with is the following:
Mass search and replace of
<head>
With:
<head><base href="http://newsite.com/newfolder">
and then search and replace
"/ or '/
with
"
Your milage may vary. I also had to replace some urls inside the javascript code.
Anything that started with a forward slash.
I am trying to copy a link from this site (stack overflow), but I like the link to include a hash so when someone clicks on the link they go directly to the answer I would like them to see. How can I find the hashes in a page?
Example:
http://www.blahblah.com/index.php#label
How can I know there is a #label, and how to find it?
The value of the hash is simply the ID attribute of any element in the page.
You can see them in the source or the DOM inspector.
Are you looking for something like this?
var hash = window.location.hash;
There might not be a simple answer for your here. In a pure HTML context (i.e. excluding javascript functionality). The has would reference an anchor on the page like this:
<a name="label"></a>
So you could just look for named anchors.
Now, if you are talking about javascript functionality it gets much more complex. Via javascript you can use a hash tag like that and make it do any number of things (like show a hidden element with id="label", download some content asynchronously based on that hash, etc. So there might not be an easy way to determine allowable values.
I'm writing a forum-type discussion board in Perl and would like to change automatically http://www.google.com to be an HTML link. This should also be safe, and err on the side of security. Is there a quick, easy, and safe way to add links automatically?
Try something like this:
use Regexp::Common qw /URI/;
$text =~ s|($RE{URI}{HTTP})(?!</a>)|$1|g
The key here is using Regexp::Common::URI which probably has a more thorough url matcher than anything I could come up with. Also I do a negative lookahead assertion at the end to make sure that the url is not already in a link. That last part isn't exactly thorough, since it's possible that somebody could do something like this:
http://www.mysite.com is my website
To do this correctly you'd need to parse the entire submission text and only substitute out urls that are not already part of a link.