I'm still struggling with the issue I described here: I need to send the user a document and the only tool available to me is requesting a URL to be opened in the default browser.
That works fine but if I link to the document directly, the browser (IE, FF, Chrome, Opera and Safari tested) creates a new, empty tab behind.
I would like to find a way to avoid that.
An additional issue is that users can use a very similar functionality to bypass the login screen and go directly to a specific page of the web app. Unfortunately, since all I have to work with is a URL, every time they invoke that function they end up opening a new tab.
So, I thought that one to solve both issue would be to be able to specify the target of the URL (as if the used clicked on a <a target="mywebapp"> link). Is that possible either through the URL itself or through the web page targeted?
Related
I'm creating a website for people who need help (getting abused and stuff).
There is an 'escape' button on the site to switch to another site if someone wants to hide what they were looking for. But the visited page is still in the history of the browser.
Is there any way to make the site remove itself from browser history?
Or does the user need to activate 'incognito' ?
location.replace SHOULD have done this
The Location.replace() method replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.
try
This test
<button type="button" onclick="location.replace('https://safe.site.com')">Leave</button>
which will replace CURRENT page - so your site needs to be a single page application (SPA) OR every click on the page needs to do location replace too
But yes, suggest incognito
It's not possible to clear user history without plugins.
For information refer to How to clear browsers (IE, Firefox, Opera, Chrome) history using JavaScript or Java except from browser itself?
There is no way of doing this. You have no control over browser history.
It's possible (under Firefox anyway) to delete history using history.deleteAll()
but that requires an extension to be added (documentation: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/history/deleteAll). Which probably doesn't help.
I writing bookmarklet to open all twitter img in newtab but it not give same result with difference browser
This is result I try
firefox 64.0.2 work on normal and private but it change original url to my bookmarklet script
firefox 64.0.2 portable not working both
chrome 71.0.3578.98 only 1 image on normal ,incognito not working
vivaldi 2.2.1388.37 work on normal perfectly ,private not working
Ex. twitter link
https://twitter.com/RadioPakistan/status/1084765300183179264
EDIT: I make it to use but...
firefox sitll open newtab and replace original tab url to bookmarklet script url
Edit2: I just add history.go(-1) after loop for prevent firefox redirect web url to script url
javascript:$=jQuery;$(".twOpenOriginalImage_touched").each(function(){var url=$(this).attr("src");window.open(url,"_blank");});
working bookmarklet
javascript:$=jQuery;$("img[data-aria-label-part]").each(function(){var url=$(this).attr("src");window.open(url,"_blank");});
C&P
I have done some searching but have found very little documentation on what can be done in a bookmarklet which cannot be done in a normal web page
That is because there is essentially none. For all practical purposes, running a bookmarklet is exactly the same as running script on the page. It is almost precisely equivalent to clicking a link on the page that has href="javascript:.."
although having written some bookmarklets already it seems they have a bit more privileged status than a normal web page (although this seems to vary by browser).
I've have also written and researched a lot about bookmarklets (check my SO history). I have found only 2 significant differences.
1.) You can use %s in the bookmark's URL in combination with a bookmark keyword for argument substitution via the URL bar.
2.) There is a weird hack in Chrome (which could easily get closed with some future update) which lets a bookmarklet open a URL in a new tab and then run code in that tab if and only if the user does CTRL+click on the bookmarklet. But that still doesn't let you do anything to tabs which are already open.
If you know others, let me know.
The only solution is to create a browser extension. If you can write a bookmarklet, it isn't much more complicated to write a very basic extension.
I'm trying to develop a Chrome extension that is supposed to completely replace a specific website's pages with a new UI. In other words, when the user visits said website, the extension should "intercept" it seamlessly and display the new "app" (preserving the URL and without opening a new tab or window). I currently use a content script to manipulate the DOM, but it's too messy.
Chrome apps such as Google Docs achieve the same goal through URL handlers, but they're not an option since they're now deprecated.
Currently, I'm aware of two options:
Intercept the URL and redirect it to an extension URL. I want the URL to be preserved.
Use a content script to stop the page from loading at document_start (using window.stop()) and then "inject" the new app. Apparently, that works, but it sounds quite hacky and prone to unexpected glitches.
What I'd like to know:
Is the second approach good enough? What limitations and other issues will I face if I use it?
Is there any other approach that is at least as good (and preferably designed for this purpose)?
You can't open a chrome app in a tab, only in a window. I don't think they have content scripts either.
Also, chrome apps are now only available on chrome os when you publish it for the first time (existing chrome apps work for any os).
To solve your question, you could use an extension with content scripts and just open up an iframe fullscreen so the url is preserved in the omnibox and it could have the page you want in the iframe as the page that would be in the app.
Content handlers are meant for opening a special protocol url to do something like send an email, etc. Examples would be like tel://, sms://, mailto:, etc.
So you would not want this. Also they aren't that noticable when approving to handle the protocol.
We have an application running in Tomcat 7
We are trying to open a window from our application using javascript, each time an event is called using window.open('url', 'name', '');
But what happens is that each time an event is called a new window is opened and the information is loaded, but it should open one window initially for the first event and for the following events it should reload the information in the same window.
We were able to avoid that situation, what we did was
We used to call our application which is deployed in a different server with the url as follows (http://servername.domain.com:8080/applicaationname), where the above issue happens
But when we call it as http://servername:8080/applicaationname, it works fine as expected
what is causing this behavior?
Many Thanks,
cheers.
In the Internet Zone (which is where your code runs when you use a fully-qualified-domain-name like servername.domain.com) your code has restricted permissions. In the Intranet Zone (which is where your code runs when you use a dotless hostname like servername) there are fewer restrictions on permissions.
The problem you're encountering is that in the Internet Zone, a named window launched from site "A" may not be navigated by JavaScript from site "B"-- instead a new window is created. We introduced this change in IE8 for security reasons, and it matches other browsers and what HTML5 demands.
See http://msdn.microsoft.com/en-us/library/dd565638(v=vs.85).aspx for more information.
I have this bookmarklet, i.e. it does not start with 'http:' but with 'javascript:'. No issue with that, it works correctly.
The problem occurs when I want to deploy this to users. I'd like to present them a link they'll just click to add to their favorites. Whatever methods I use (examples found on the web, or JQuery with jFav), I end up with a javascript error 'permission denied' when clicking the link, though it works perfectly when the link to bookmark is a classic 'http' one.
I believe that's some security in browsers, but is there a way to avoid this?
It is indeed a security measure. If a user could be tricked into bookmarking and running a javascript: URL, that's pretty much global cross-site-scripting.
About all you can do is present the user with a javascript: link, and ask them to bookmark it via right-click-bookmark or drag-to-bookmarks. You should also write the link out so it can be copy-and-pasted and manually bookmarked, because some browsers won't present right-click-bookmark for a JavaScript link, and others may not have a bookmarks bar visible.
You can ask your users to drag and drop the bookmarklet to the their bookmarks or toolbar.