The function I'm looking for:
Say I'm browsing "domainname.com", I click the extension, That then redirects me to myurl.com/site/domainname.com. I have searched everywhere and had no luck.
So from what ever "url" the user is browsing, they click the extension and it will redirect them to myurl.com/site/"Url"
Links to a helpful article or some code to finish off my script would greatly appreciated. I have a basic .json file setup from some demo extensions, I need help with grabbing the users current url and then redirect to my site if they click. Thanks in advance...
Edited the question slightly. Hope it make a little more sense now.
Start by asking for the tabs permission in manifest.json:
...
"permissions": [
"tabs"
]
...
Next, in a script that runs off of a background page, add this:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
{
if (tab.status == "complete")
{
tab_url = tab.url;
// ...
tab_url will now contain the name of the current tab whenever that tab is updated. From within that code, you can do whatever you want, in your case, sanitizing the URL and redirecting to http://www.myurl.com/whatever.com using top.location.href.
Your question is hard to understand... but if you're asking what I think you're asking your redirects will probably work properly if you add "http://" to the beginning. If you don't do this, Chrome will assume the link is relative and will use the current domain and path when resolving the link.
Related
I want to make it so when a user enters the URL of the app they'd get the same page, no matter what they added after the '/', but have a string stored in the code with the value after the '/'.
for example: if they enter the URL "exampleurl.app/blabla", the String would have the value "blabla".
I managed to that somewhat with Uri.base, the problem is that after the app loads the URL removes all the text after the '/' automatically, and whenever I reload the site it reloads it without the URL with the text removed.
Also if the current URL in the tab is already of the app ("exampleurl.app/nomatterwhatsaddedhere"), it assumes that it is the same URL and doesn't even reload.
It would be greatly appreciated if someone could show me a way to get the string from the URL without these issues.
Thanks in advance!
You need to use Navigator 2.0 for this kind of functionality. I recently wrote a short series that explains simply how to implement Navigator 2.0. It goes into detail explaining how to work with the URL in an app for similar functionality to what you are after, though you will need to tweak it for your use case. It provides a detailed walkthrough along with sample code available on GitHub.
A Simpler Guide to Flutter Navigator 2.0
I have a website where I installed Prestahop on a /shop directory but will want to redirect the homepage to the main homepage while other product pages function normal without using a module and without redirecting all pages to the new URL.
EG. I want to change example.com/shop to examplae.com while other pages like example.com/shop/category/product1 work normal.
I posted the question because there seem to be very little resources
on this topic as most answers I got while researching are eighter directing users to buy
modules or to do a general redirect.
It worked for me. In my case, I changed the home page to another URL which is mine. Other product pages still work normal. To do that, go to controllers/front/IndexController.php and change add the following code somewhere in the initContent function.
Tools::redirect('http://newwebsiteurl.com/');
That is you will delete all the contents in the function below
{
parent::initContent();
$this->addJS(_THEME_JS_DIR_.'index.js');
$this->context->smarty->assign(array('HOOK_HOME' => Hook::exec('displayHome'),
'HOOK_HOME_TAB' => Hook::exec('displayHomeTab'),
'HOOK_HOME_TAB_CONTENT' => Hook::exec('displayHomeTabContent')
));
$this->setTemplate(_PS_THEME_DIR_.'index.tpl');
}
and replace it with something like this:
{
parent::initContent();
Tools::redirect('http://newwebsiteurl.com/');
}
It worked for me on my website Soup Embassy and I hope does for you too. If you check the URL on Soup Category here, you will see that it is in a directory /buy-online/ and when you click on the home link or logo, it will redirect you to a URL without the extension. I hope you find this helpful.
I´ve a strange Joomla 2.5.9 problem where I do not know if it´s a bug or a setting issue.
Anyway my problem is I ´ve created a menu item kind "Blog List", choosed a category and set the "access" of the articles to "registered" and "show unauthorized access links" to yes. Now the user can see the articles, but is redirected to the login if he clicks "read more".
steps can be seen here (-> http://tinyurl.com/bldbvx4)
So far so good. Unfortunately the return URL for the article is not created correctly.
I ´ve created a demo installation which illustrates my problem.
http://seminare-gratz.de/Joomla_2/index.php/problem
Login:
demo
demo
If I click "Koala" and log-in in the next step, Joomla tries to redirect me to:
http://seminare-gratz.de/Joomla_2/index.php/%2FJoomla_2%2Findex.php%2Fproblem%3Fid%3D25%3Akoala
correct would be:
http://seminare-gratz.de/Joomla_2/index.php/problem/25-koala
To solve this issue I tried to cut the wrong part with htaccess (failed)
Any clue how to fix this?
Thankful for any help,
Tony
Okay, got it. For everyone else having this problem. I did a template override of:
components/com_content/views/category/tmpl/blog_item.php
and cutted the urlencode in line 149.
//$link->setVar('return', base64_encode(urlencode($returnURL)));
$link->setVar('return', base64_encode($returnURL));
with this hack it works ...
This is because you have given Access level to register so normal users are not allowed to read this article. So you kindly change access level registered to public.
I want to make a button that shares links in this form:
http://example.com/#anchor
but when i click it, it shares only
http://example.com
How could I make it share what I want?
This is very simple; your URL string you want to share should be like this: http://www.domain.com/hello.html%23myanchor
The %23 will be transformed by Facebook into a #.
Your question is not very detailed and it's not easy to understand exactly what it is you're asking for..
Since the share functionaliy was deprecated I assume that you are talking about the Like button.
As you can see in that page you can put what ever url you want into the "URL to Like" field, then click the "Get Code" button and use that code in your page.
You can put the code in any page, so if your page is: "example.com/#anchor" you can still have the button like "http://example.com" or the other way around.
If however you want the user to like "example.com/#anchor" but when someone clicks on the liked link he will get to "example.com" then it's not possible.
I just thought about this (because I have the same problem).
My idea is to share a php link with a variable, let's call it 'a' for anchor, which is the anchor without # so that facebook won't remore it.
Thus you share the link:
http://www.mywebpa.ge/?a=anchor1
Then you just have to recover the value of 'a' with php and add a little script which makes you go to the anchor.
I hope it will help you.
Regards
It is not very clear as to what rules the next parameter need to follow in order to be valid with the add tab dialog.
I wish the documentation was more clear. As through trial and error I have worked out enough for just now but I want to know if you need to setup the apps as website apps or if you need the domain setup, which requires being setup as a website app. Also it appears you can specify a subdomain with no issues?
It's just not clear at all.
Can we please have clearer documentation? I realise I maybe posting this in the wrong place as well, so if this should be filed somewhere else can someone please let me know.
Thanks!
Stefan
Next is the url where you are redirect after you have added the tab
example:
next="https://www.yourdomain.com/add_tab.php"