I have the following javascript bookmarklet which opens a new popup window with a facebook post page in side of it.
javascript:var d=document,f='http://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1261526047&u='+e(l.href)+'&t='+e(d.title);1;try{if (!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z) {a=function() {if (!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if (/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)
I just add that code into the URL of a shortcut link in my browser and it opens the facebook post page and passes the URL and some info about the page I am on to it.
I need to do a much simpler task. I need to get the URL of the page I am on and either open a new tab or even just use the tab I am in and then open a link like this
http://mydomain.com/labs/iframe_header.php?url= PUT THE CURRENT PAGES URL RIGHT HERE
As you can see I just need to make a bookmarklet that will take the page I am on and pass it into my sites page. Can anyone help me, I don't know much javascript at all, would greatly appreciate any help.
javascript: location.href = 'http://mydomain.com/labs/iframe_header.php?url=' + escape(location.href);
This will open in a new window, which will use a new tab if your browser is set up that way:
javascript: window.open('http://mydomain.com/labs/iframe_header.php?url=' + escape(location.href));
Related
Is it possible to make my website url always open in single window where if user even try to run url in tab then my website automatically redirect and open in single popup wimdow.?
Please share your idea and help how I do this if it is possible thank u all.
Simple answer is no.
It's not logical or reasonable.
You can't control browser but you can control another page in your website to have fixed height and width in a new pop up browser control.
onClick="window.open('yourpage.htm',' pagename','resizable,height=260,width=370'); return false;"
Sorry to add to the burgeoning noise on bookmarklets. I'm having trouble figuring out the right approach and some trouble coding it.
When the bookmarklet is activated, I want to
1) Open a popup as about:blank
2) Then change the URL to my external web page which handles the functionality of the bookmarklet
3) And in the process pass parameters to that page in the GET request
It should be easy right? Then why does #1 insist opening a new tab in Chrome rather than a popup?
<a href="javascript:(function(x) {var mypop=window.open('about:blank',config='height=200,width=400,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no');})('hello world');" >Click</a>
What am I doing wrong?
Thanks
You forgot the second parameter to window.open(), so your config string is being interpreted as window name, not settings. Use this:
window.open('about:blank', '_blank', '... your parameters ...');
I am displaying an online internal website.
Upon clicking on a button "A" it processes a task, and goes to another HTML page. However, this direct address is like "hidden" (hard to explain).
For example, for each page I am accessing by simple button click, it's always the same URL (like http://host.com for every page I display from them).
I am using Firefox, and I need to know how to get the exact HTML address (or direct URL) used for displaying these full new pages. I managed to do it few months ago, but not anymore.
It will help me to automate some tasks and bashing programs. I am openned to any linux browser in case you find a way to help me. Thanks a lot.
it sounds like domain masking is used. you could check the source and see if a frame is being used on the page. the source should indicate the src of the frame, revealing the location of the page.
<frame src="page.html">
If the button uses window.open to navigate to the url, you could override that method and intercept the url there:
var oldOpen = window.open;
window.open = function(){
console.log(arguments[0]);
oldOpen.apply(window, arguments);
};
I've written a simple bookmarklet that opens multiple web pages with a single click:
javascript:(function(){window.open("http://www.w3schools.com");window.open("http://www.google.com");window.open("http://www.yahoo.com");})();
I wan't to be able to open the browser and click this immediately, but the bookmarklet won't work unless a page is already loaded in the window. I prefer to have my browser home page set to "Blank" for speed. Is there a way to make this bookmarklet execute without a page already loaded?
Also, I'd like the bookmarklet to replace whatever page is loaded in the window, if something is indeed loaded. At present, it opens 3 new tabs. I've tried the "_self" and "_parent" values for the "name" attribute on the first window.open, but it doesn't seem to work. I may not be formatting it correctly.
Any help is appreciated! Thanks!
It isn't possible to open bookmarklet in no page.
Instead, you can try to set your homepage to something like data:text/html,Welcome! (yes, it IS a working URL).
To open a page in the same tab, type:
location.href='http://www.w3schools.com'
I was having the same problem, and learned from the internet that if you go to your about:config, search for browser.newtab.url and change it to about:blank instead of the default about:newtab your javascript bookmarklets should work (just tried, and it's working!). This should be cleaner than doing a data:text/html message (in any case even if you set the homepage it doesn't work for every new tab, only once for a new window)
I am wondering whether it's possible to close a tab as soon as a new site has loaded, without having to use js on the new site. I basically want to close the tab when we receive any content from the new site.
I use this to trigger a click event which submits a form:
$('#target_attack').click();
I tried putting window.close() right after this, but the tab closed without having loaded the new site.
I also tried to pause the script for 3 seconds and then close the tab, but for some reasons the site then won't load.
I also thought about using sessions but this means I would have to use js on the other site too, which I want to avoid.
I hope you guys can help a little javascript noob C:
Thanks in advance!
Guessing you are using window.open to open it in a new tab.
var winPop = window.open(url);
$(winPop.document).ready(function() {
window.close();
});
If javascript didn't open the window, javascript cannot close the window. Otherwise, window.close() is what you use.
You can try to bypass this security restriction (bad plan), but I do not believe this works on newer versions of any browser:
window.top.opener=null;
window.close();
See the docs - Firefox: https://developer.mozilla.org/En/DOM:window.close, IE: http://msdn.microsoft.com/en-us/library/ms536367%28VS.85%29.aspx