URI

Get more actions or share your own!
Locked
Netsu
Posts: 2
Joined: Sat Apr 30, 2011 11:06 pm

URI

Post by Netsu » Sat Apr 30, 2011 11:19 pm

Please add to custom action syntax parameter {uri} and domain name without www.

Advertisements

 

User avatar
DaveG
Flagfox Developer
Posts: 723
Joined: Wed Oct 03, 2007 9:06 pm
Location: Philadelphia, USA

Re: URI

Post by DaveG » Sun May 01, 2011 6:32 pm

There are already parameters that do what you ask. The {fullURL} placeholder gives the full URL of the page and the {baseDomainName} placeholder gives the domain name without the "www" subdomain. (both are available in Flagfox 4.0+)

If these aren't enough for what action you're trying to write, please elaborate.

Netsu
Posts: 2
Joined: Sat Apr 30, 2011 11:06 pm

Re: URI

Post by Netsu » Sun May 01, 2011 11:00 pm

{fullURL} now (example):
http://flagfox.servehttp.com/forum/view ... ?f=5&t=325
I need uri of this page:
forum/viewtopic.php?f=5&t=325
Or tip for make two urls:
www.flagfox.servehttp.com/forum/viewtopic.php?f=5&t=325
and
flagfox.servehttp.com/forum/viewtopic.php?f=5&t=325
With uri it's will:
www.{baseDomainName}/{uri}
and
{baseDomainName}/{uri}

User avatar
DaveG
Flagfox Developer
Posts: 723
Joined: Wed Oct 03, 2007 9:06 pm
Location: Philadelphia, USA

Re: URI

Post by DaveG » Mon May 02, 2011 6:32 am

Netsu wrote:{fullURL} now (example):
http://flagfox.servehttp.com/forum/viewtopic.php?f=5&t=325
I need uri of this page:
forum/viewtopic.php?f=5&t=325
Or tip for make two urls:
http://www.flagfox.servehttp.com/forum/viewtopic.php?f=5&t=325
and
flagfox.servehttp.com/forum/viewtopic.php?f=5&t=325
With uri it's will:
www.{baseDomainName}/{uri}
and
{baseDomainName}/{uri}
In this context URI is a synonym for URL. (URI article on Wikipedia; diagram in MDC article) You're not asking for a parameter for the URI, you're asking for a parameter for the path.

In that case, I don't see how a parameter for the path would be particularly useful. Could you please provide an example use case?

Note also that {baseDomainName} for this domain will be "servehttp.com" (a free DNS provider) not "flagfox.servehttp.com". The "www" on the front of a domain name is not special; it's just a subdomain and done these days more or less because people are used to it.

Roman0
Posts: 3
Joined: Sun Jul 17, 2011 12:37 pm

Re: URI

Post by Roman0 » Sun Jul 17, 2011 12:46 pm

Here is an example of when the path part can be useful:
http://flagfox.servehttp.com.nyud.net/f ... ?f=5&t=325
See the description http://www.coralcdn.org
Last edited by Roman0 on Sun Jul 17, 2011 2:36 pm, edited 1 time in total.

Roman0
Posts: 3
Joined: Sun Jul 17, 2011 12:37 pm

Re: URI

Post by Roman0 » Sun Jul 17, 2011 1:40 pm

Never mind, javascript:window.location="http://{domainName}.nyud.net"+window.location.pathname+window.location.search does the job. Thank you! )

PS You can also use window.open(...) instead of window.location= to open in new tab/window. Also, javascript:window.location=window.location.protocol+"//{domainName}.nyud.net"+window.location.pathname+window.location.search doesn't help with https because there is no SSL on nyud.net

User avatar
DaveG
Flagfox Developer
Posts: 723
Joined: Wed Oct 03, 2007 9:06 pm
Location: Philadelphia, USA

Re: URI

Post by DaveG » Sun Jul 17, 2011 9:37 pm

Roman0 wrote:Never mind, javascript:window.location="http://{domainName}.nyud.net"+window.location.pathname+window.location.search does the job. Thank you!
Yep, Flagfox 4.1+ lets you do things like this rather easily. Thanks for posting that.

You can actually do it a little simpler as Flagfox 4.1+ JavaScript actions have the content window object usable implicitly as if it were running in the content (though it's actually executed in a separate sandbox). So, you can drop all the usages of "window." to simplify things:

Code: Select all

javascript:location="http://{domainName}.nyud.net"+location.pathname+location.search
Roman0 wrote:PS You can also use window.open(...) instead of window.location= to open in new tab/window.
I don't think I documented this anywhere, but JS actions have access to a few extra functions. You can use the "openURL()" function to open a URL using the method set in the Flagfox options dialog used for normal URL-based actions:

Code: Select all

javascript:openURL("http://{domainName}.nyud.net"+location.pathname+location.search)

Roman0
Posts: 3
Joined: Sun Jul 17, 2011 12:37 pm

Re: URI

Post by Roman0 » Mon Jul 18, 2011 7:30 am

Even better! Great application, thank you very much!

Locked