I want to have a link or something which could be inserted in an email/forum etc. It's a typical url. But I would like that link to be opened in a custom sized new browser window ( say 800 x 600 ) . It sounds weird, but that is the requirement. Can it be achieved somehow?
Thanks
In an email?
You can't. Email clients insane enough to execute JavaScript are all by unheard of.
In a forum?
Assuming you aren't the administrator of it, you can't. Forums insane enough to encourage XSS attacks are, again, all but unheard of.
Ok. This is how we could kinda achieve this. Let that link be a normal link. It would contain the custom code to create a desired popup on invocation. But the issue is popup blocker in browser. But they somehow liked it.So basically a page opens up which launches the popup without user interference.
Related
What is causing some browsers to see my code as unsolicited?
I have a web site devoted to helping people with interactive sessions. It starts with the user clicking [Begin] so this is a consented action. This should (1) open a popup while (2) redirecting the first page to a end page as below :
<head>
<SCRIPT language="JavaScript">
function openwindow(){window.open("{INTERACTION}","interaction","resizable=0,width=800,height=600,status=0");}</SCRIPT>
</head>
<body>
<FORM action="end.php" method="{METHOD}" >
<input type="submit" class="button"
onClick="javascript: openwindow()"
value="Begin" />
</FORM>
</body>
As said, this is not trying to open an unrequested popup but some strains of IE and Chrome appear to be treating it as such. I have been trying to get a fix, most recently digesting this post.
In it Bobince comments
these days, you don't really need to ask the question “was my unsolicited popup blocked?”, because the answer is invariably “yes” — all the major browsers have the popup blocker turned on by default. Best approach is only ever to window.open() in response to a direct click, which is almost always allowed.I'm quite happy to buy into this principle because I simply want my popup to open.
What is causing some browsers to see my code as unsolicited?
I'd appreciate any help you could give me. (as you might have guessed, client side is not my bag and this topic has been bugging me for ages).
Many thanks in advance (and fingers crossed)
Giles
No much you can do. You could ask your users to disable pop-up blockers or inform them that a pop-up blocker is enabled by checking the window object ref returned by window.open()
e.g.
var w = window.open('http://domain.com');
if(!w) {
//an alert in this example
alert('oops..seems like a pop-up blocker is enabled. Please disable');
}
you could find another way and try what Brad suggests.
There isn't anything you can do about this. Some popup blockers still block everything, even in response to a user clicking. The best you can do is suggest your users turn off popup blockers, or find a different way to do what you want to do. A popular method is the div that appears on top of all others on your page, like Lightbox.
There are many jQuery plugins which make this easy.
You have (at least?) 2 options to deal with this:
if you want to keep using popups, display a very visible warning for your users, pointing them to instructions on how to configure their browser to whitelist your domain (like the banners that appear on top of StackOverlow.com when you gain new privileges, or even like the banners Chrome is showing for actions - they are web-based as well);
use an iFrame and load its content based on your user's click.
I'm quite new at Javascript, and have so far only used the DOM, but I now need to access the browser model, and I don't know if what I'd like to do is possible.
The problem: sometimes I let my youngest daughter browse some kid-friendly Flash game sites. The problem is that most flash games display links to other sites in their splash screens. So often, my daughter chooses a game, and then, while the Flash game is loading, she clicks on the splash screen, which takes her to some other site. It drives me nuts, because every two minutes she calls for help, as the browser has opened a new tab on some other site.
My specific needs:
I wondered if there might be some way with Javascript, like with a bookmarklet or something alike, at any particular moment lock down the browser in some kind of pseudo-kiosk-mode, so it ONLY follows links to URLS on the current domain, ie the domain in the address bar when the bookmarklet was activated.
I don't expect anyone to solve the whole problem for me, but some pointers would be greatly appreciated. Thanks a lot in advance.
If the link is being opened from Flash, you can't do anything about it. If it was a normal HTML link you could try to intercept the click event and block it if it's an external link. But with Flash, you're out of luck.
You're going to need some kind of browser extension or external monitoring software for that.
Extending what Matti said, I see two approaches worth looking into. If you search for something like "your_browser kiosk", replacing your_browser with the actual name of your browser, you'll likely find some useful tools. Alternatively, if there is a consistent set of problem sites, you could modify your hosts file to block those sites' domains.
We want to let users click a thumbs up or thumbs down button from an HTML email, without causing the clicking to open a browser window.
Is there a way to essentially embed limited web functionality (i.e., clicking an icon, showing confirmation) within HTML emails?
Thanks!
I'm afraid such functionality, while theoretically possible, wouldn't be very practical given that most email clients strip out or disable JavaScript in order to prevent malicious code execution or other security issues. Your best bet is to use an image that looks like the thumbs up or thumbs down and then links directly back to your website. The browser window will still need to be opened, but you'll at least achieve the main part of your goal.
The short answer is no, not reliably across email clients. Usually with something like this I'd embed an image that looked like your functional element and just have it link to a web page that has that functional element.
Using JavaScript, is it possible to add a bookmark in Firefox directly, without opening any dialog box? That is, I want the user clic on a link and that the bookmark is automatically created, without the need to any further step.
Fortunately, no. It would be a horrible breach of security.
Could be a different story in the context of a Firefox Extension, but I assume you are asking for a normal web page.
If it was possible, any possible website would be able to create any kind bookmark, without the user even noticing.
As a user, I certainly hope this is not possible ^^
(And, as a developper, I don't think it is)
How can we hide the statusbar of a current page using javascript.I used window.statusbar.visible = false but its not working.Please give me a solution
regards
Arun
I don't think you can hide it for an already opened window : it's not an element of the page, but an element of the browser's user interface -- which means it's outside of your concern.
(Even if you can open a new window that doesn't have a status-bar ;; which might not be liked that much by some users, btw)
Status bars are something people expect to see in every browser window. By not hiding it, you give users the first sense of safety that the content they see is still being served within a browser. You may be trying to simulate a desktop application experience on the web. But once you code for the web, you have to happily accept the standard elements that come with it.
Technically, no, you cannot hide the status bar after opening the window.