How to open a new windows on body load in blogger? - wordpress

I have my blog under url http://www.funjin.blogspot.com and i want to open a new window having specific url when the blog loads. Can anybody help?

You can use javascript to open a popup window when a user logs on. However, if you have a popup blocker installed, it won't open at all. Also, some browsers will not allow popups at all. It would be better to have the user click a link and then the popup opens.
<script type="text/javascript">
window.onload = function() {
window.open('http://www.google.com','google',' menubar=0, resizable=0,dependent=0,status=0,width=300,height=200,left=10,top=10')
}
</script>
Change the settings for url, width, and height to whatever you need.

Related

AddThis Share : LinkedIn always open in new window

We're using AddThis Social Share functionality with our Sitecore/MVC application. The problem we're facing is that the LinkedIn share always opens in new window. On Inspect, we can see the target=_blank in code, which is not being added in our code.
Any help?
Thanks,
Chandana
The behavior of each share button is as per the website to which the page is being shared. If you test each button (say Facebook, G+, Twitter, LinkedIn, etc.) you will notice that they all work differently. It's not AddThis choice. This is because each website has its own API and that's the way that website decided it would work with their system. LinkedIn happens to open a separate window... Pinterest first opens a popup within your page and then another window after you selected the image you wanted to share. G+ and Facebook open a new tab. And the popups/windows all look quite different, but the users should recognize each respective brand as a result...
I suspect that this is a problem with the AddThis Social Share functionality. To share on LinkedIn, all you need is the following URL format...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Then you can setup your <a href="..."> element however you like, with target="_blank" or not.
Source: Official LinkedIn Sharing Documentation.
Can try out below JavaScript code, which will overwrite addthis functionality, and make linkedIn as popup,
setInterval make sure click event attached to dynamically generated anchor tag
$(document).ready(function () {
var clickinterval = setInterval(setclickevent, 500);
function setclickevent() {
if ($('.at-svc-linkedin').length > 0) {
$('.at-svc-linkedin').on('click', function () {
window.open('https://www.linkedin.com/sharing/share-offsite/?url=' + fixedEncodeURIComponent(window.location.href), 'popup', 'width=600,height=600');
e.preventDefault();
return false;
});
clearInterval(clickinterval);
}
}
function fixedEncodeURIComponent(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16);
});
}
});

Only available via iframe

Is there a way of making a webpage only available through an iframe? Basically if you go directly to the iframe source you wouldn't be able to see the content, but if you view the site through an iframe you would be able to see the content.
A jQuery or Javascript solution would be perfect, and I do have to power to edit the source.
try adding this in head of your webpage
<script type="text/javascript">
if (top === self) {
alert('Sorry ! WebPage is only accesible via iframe') //if current window is topmost window
window.close();
} else {
alert('Well Done');
}
</script>
self means current window and top means browser's topmost window

To disable the addressbar and standardbuttons bar in IE when my application lanches?

when my application launches in the IE from start page to main page i want to hide the addressbar and the standardbuttons bar of IE through the codebehind and here am using masterpage concept so i have to write the code in master only i think so....can anyone help for this
AFAIK you cannot disable address bar and button in IE from when the application starts unless using some ActiveX, Flash, ... Only if your application opens new window popups you could hide them.
I just found a way... It works atleast in IE 7... Not sure about other browsers...
<html>
<head>
<script>
if (window.name == 'default') {
window.name = 'Hai';
window.open('main.html', '_self'); // Current html file name
}
else if(window.name == '') {
window.name = 'Hai';
window.open('main.html', '_self'); // Current html file name
}
else if(window.name == 'Hai') {
// Use your application startup page here along with the desired options
window.open('newfile.aspx','NEWWINDOWNAME', 'Status=0, location=0');
window.close();
}
</script>
</head>
<body>
This window automatically closes itself
</body>
</html>
The complete list of options are available here.
Hope this helps.
Explanation : (AFAIK) Generally when javascript uses window.close method to close the active window, IE will ask for a confirmation from the user. Such confirmation will not be asked when the window is a popup window opened previously by a javascript along with a name.
The above just fakes the same, by opening the same file in the same window but this time with a name. As a result when window.close is executed, IE recognises the current window as a window opened using Javascript and as it also has a name, it just closes the same without confirmation.
Of course, I get a general Javascript alert at the beginning of the load, but since (I presume) you will be using aspx or other types, this problem will not be there.

Open browser in Full screen

net website, I would like to add button by which user can view the page in Full Screen mode and switch back to Normal mode. [This is same as happens with F11]
I have seen many javascript code but all of them is opening new window in full screen.
But i would like have same window in Full screen
If it happn then i will put that button in MASTER page.
Please help?
I don't think it is possible to do what you are asking.
The only possible way is using window.open:
<span onclick="window.open('http://www.yourdomain.com/page.html','', 'fullscreen=yes, scrollbars=auto');">Open Full Screen Window</span>
(I'm not sure it's a good idea to force a user to use full screen mode...)
ugly solution but it works
<head>
<script type="text/javascript">
function max()
{
var obj = new ActiveXObject("Wscript.shell");
obj.SendKeys("{f11}");
}
</script>
</head>
<body onload="javascript:max()">
</body>
User already has this button, it's called F11.
DO NOT try to be 'smart'. This kind of functionality is in browser's scope, not in web application scope. It should not be your concern at all.
Instead focus on features that are truly relevant to your application.

Opening IE Window from within Flex

All I need to open a new IE Window from within Flex code on click of a link.
P.S I dont want to open a new Browser. I want to open a browser window only that can open a new URL.
Something like clicking on a link in Flex and then open cnnibn.com in a Pop up window.
You should just be able to use:
navigateToURL(new URLRequest('http://www.cnnibn.com'), '_blank');
(make sure you import the relevant packages: "import flash.net.*")
This approach may have issues with some popup blockers, if so then you could have a look at the class here:
http://www.zorked.com/flash/flash-and-navigatetourl-popup-blocking/
One of the following methods will work unless the popup blocker blocks it.
Use navigateToURL
Add the following to the click handler of the button
navigateToURL(new URLRequest("cnnibn.com"), "_blank");
Use ExternalInterface
Add this line to click handler
ExternalInterface.call("openPopup", "cnnibn.com");
And the following to a script tag in the embedding html page
function openPopup(url)
{
window.open(url, "_blank");
}

Resources