How can i create webpage with out address/menu and tool bar - javascript

How can i create web page with out address/menu and tool bar.
I want the page to load without address/menu and tool bar.
Can someone please help to create webpage in asp.net or html using javascript.
I tried using javascript by using following code, but this warns that this page is closing i dont warning to be display.
a.htm
<head>
<script type="text/javascript">
function init()
{
var window_dimensions = "toolbars=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=yes";
window.opener=self;
window.close();
window.open("b.htm","_blank", window_dimensions);
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height-100);
}
</script>
</head>
<body onload="init()">

These are standard security restrictions today, put there for good reason. Don't try to work-around them. If you think you have a need to do so, I'd re-review your requirements and reasons for doing so. If it is truly a need, you may need to consider a custom desktop (non-web-browser) application. This could still be a HTML-based application, but a custom desktop "browser" would be required.
See also: How to pop out a Firefox window without an address bar or status? (This includes excellent details for a custom desktop "browser", and follows the above recommendation.)

Related

AddThis plugin can not exclude services in mobile tool box

I have implemented the addThis share box following their instructions. I would like to only include the following services in the share tool box which works fine on the desktop browser but is simply ignored on mobile, which means that every service is shown on the mobile version of the share box.
Anyone else encountered this issue? What can be done to fix it?
<script src="https://s7.addthis.com/js/300/addthis_widget.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="share_btn">Press me to test sharing!!!!</div>
<script>
var addthis_config = {
services_expanded: 'facebook,twitter,email,tumblr,link,sinaweibo,whatsapp'
}
$(".share_btn").on("click", function () {
addthis.update('share', 'url', 'http://google.com');
addthis_sendto('more');
});
</script>
JSFiddle - Test link
This is a bug
You are correctly applying the config the problem is that this is a bug that has been around for a couple of years now:
A user asked back in June 2013:
We have an addthis control that properly displays only the sharing services that we specify when viewed using a desktop browser. When it is viewed from a mobile device (iphone in this case) it switches to the mobile view i na new tab (which is good), but then it displays every possible service instead of just the specific ones that we want to show. Is there some additional configuration we need to do up front in addition to what we are already doing?
To which a member of the AddThis team responded:
I tested this on a local environment and experienced the same result. I have put in a ticket with our development team for a fix in a future release. Thank you for reporting this to us.
AddThis Support (Addthis mobile not respecting 'services_compact' or 'services_expanded')
This was still outstanding when another user asked if it had been fixed a year later.
What can you do?
It seems that the only option you have is to use services_exclude instead which does appear to work on mobile devices. This will lead to a lot longer list and a bit more of a configuration headache but it should allow you to almost get the list you are after on the mobile menu.
<script src="https://s7.addthis.com/js/300/addthis_widget.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="share_btn">Press me to test sharing!!!!</div>
<script>
var addthis_config = {
services_exclude: 'dashboard,menu,compact,email,facebook_like,foursquare,google_plusone,pinterest,100zakladok,a97abi,addressbar,adfty,adifni,advqr,amazonwishlist,amenme,aim,aolmail,apsense,arto,baang,baidu,balatarin,balltribe,beat100,biggerpockets,bitly,bizsugar,bland,blogger,blogkeen,blogmarks,blurpalicious,bobrdobr,bonzobox,socialbookmarkingnet,bookmarkycz,bookmerkende,box,brainify,bryderi,buddymarks,buffer,camyoo,care2,foodlve,chiq,citeulike,classicalplace,google_classroom,cleanprint,cleansave,cndig,colivia,technerd,link,cosmiq,cssbased,delicious,diary_ru,digaculturanet,digg,diggita,digo,diigo,domelhor,douban,draugiem,dzone,edcast,efactor,mailto,embarkons,evernote,stylishhome,fabulously40,informazione,thefancy,fashiolista,favable,faves,favlogde,favoritende,favorites,favoritus,financialjuice,flipboard,folkd,thefreedictionary,fresqui,funp,gg,gmail,govn,goodnoows,google,googleplus,googletranslate,google_plusone_share,hackernews,hatena,gluvsnap,hedgehogs,historious,hootsuite,hotmail,w3validator,identica,ihavegot,indexor,instapaper,iorbix,irepeater,jamespot,jappy,jolly,kaevur,kaixin,kakao,ketnooi,kik,kindleit,kledy,latafaneracat,librerio,lidar,lineme,linkedin,linkuj,livejournal,mymailru,margarin,markme,meinvz,memonic,memori,mendeley,meneame,mixi,moemesto,moikrug,mrcnetworkit,myspace,myvidster,n4g,naszaklasa,netlog,netvibes,netvouz,newsmeback,newsvine,nujij,nurses_lounge,odnoklassniki_ru,oknotizie,openthedoor,oyyla,packg,pafnetde,pdfonline,pdfmyurl,phonefavs,pinboard,pinterest_share,planypus,plaxo,plurk,pocket,posteezy,print,printfriendly,pusha,qrsrc,quantcast,qzone,reddit,rediff,redkum,renren,researchgate,safelinking,scoopat,scoopit,sekoman,select2gether,shaveh,shetoldme,skype,skyrock,slack,smiru,sodahead,sonico,spinsnap,yiid,startaid,startlap,studivz,stuffpit,stumbleupon,stumpedia,sulia,sunlize,supbro,surfingbird,svejo,symbaloo,taringa,telegram,tencentweibo,thewebblend,thisnext,tuenti,tulinq,twitthis,typepad,urlaubswerkde,viadeo,viber,virb,visitezmonsite,vk,vkrugudruzei,voxopolis,vybralisme,wanelo,internetarchive,sharer,webnews,domaintoolswhois,windows,wirefan,wishmindr,wordpress,raiseyourvoice,wykop,xanga,xing,yahoomail,yammer,yardbarker,yigg,yookos,yoolink,yorumcuyum,youmob,yummly,yuuby,zakladoknet,ziczac,zingme'
}
$(".share_btn").on("click", function() {
addthis.update('share', 'url', 'http://google.com');
addthis_sendto('more');
});
</script>
The Stack Snippet doesn't appear to work so to see this in action please see this JSFiddle.
Unfortunately, using this method highlights another bug which leads to the duplication of the Facebook, Twitter and Tumbler buttons (as seen above). There does not appear to be a way to configure AddThis to stop this duplication, however, this can be tackled from a different angle.
The mobile menu gets given unique classes (to differentiate it from the desktop menu) and the duplicates always appear to be the first three items. This means we can use CSS to hide the first three list items and by extention remove the duplicates from view.
.at4m-listitem:nth-child(-n+3) {
display: none;
}
<script src="https://s7.addthis.com/js/300/addthis_widget.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="share_btn">Press me to test sharing!!!!</div>
<script>
var addthis_config = {
services_exclude: 'dashboard,menu,compact,email,facebook_like,foursquare,google_plusone,pinterest,100zakladok,a97abi,addressbar,adfty,adifni,advqr,amazonwishlist,amenme,aim,aolmail,apsense,arto,baang,baidu,balatarin,balltribe,beat100,biggerpockets,bitly,bizsugar,bland,blogger,blogkeen,blogmarks,blurpalicious,bobrdobr,bonzobox,socialbookmarkingnet,bookmarkycz,bookmerkende,box,brainify,bryderi,buddymarks,buffer,camyoo,care2,foodlve,chiq,citeulike,classicalplace,google_classroom,cleanprint,cleansave,cndig,colivia,technerd,link,cosmiq,cssbased,delicious,diary_ru,digaculturanet,digg,diggita,digo,diigo,domelhor,douban,draugiem,dzone,edcast,efactor,mailto,embarkons,evernote,stylishhome,fabulously40,informazione,thefancy,fashiolista,favable,faves,favlogde,favoritende,favorites,favoritus,financialjuice,flipboard,folkd,thefreedictionary,fresqui,funp,gg,gmail,govn,goodnoows,google,googleplus,googletranslate,google_plusone_share,hackernews,hatena,gluvsnap,hedgehogs,historious,hootsuite,hotmail,w3validator,identica,ihavegot,indexor,instapaper,iorbix,irepeater,jamespot,jappy,jolly,kaevur,kaixin,kakao,ketnooi,kik,kindleit,kledy,latafaneracat,librerio,lidar,lineme,linkedin,linkuj,livejournal,mymailru,margarin,markme,meinvz,memonic,memori,mendeley,meneame,mixi,moemesto,moikrug,mrcnetworkit,myspace,myvidster,n4g,naszaklasa,netlog,netvibes,netvouz,newsmeback,newsvine,nujij,nurses_lounge,odnoklassniki_ru,oknotizie,openthedoor,oyyla,packg,pafnetde,pdfonline,pdfmyurl,phonefavs,pinboard,pinterest_share,planypus,plaxo,plurk,pocket,posteezy,print,printfriendly,pusha,qrsrc,quantcast,qzone,reddit,rediff,redkum,renren,researchgate,safelinking,scoopat,scoopit,sekoman,select2gether,shaveh,shetoldme,skype,skyrock,slack,smiru,sodahead,sonico,spinsnap,yiid,startaid,startlap,studivz,stuffpit,stumbleupon,stumpedia,sulia,sunlize,supbro,surfingbird,svejo,symbaloo,taringa,telegram,tencentweibo,thewebblend,thisnext,tuenti,tulinq,twitthis,typepad,urlaubswerkde,viadeo,viber,virb,visitezmonsite,vk,vkrugudruzei,voxopolis,vybralisme,wanelo,internetarchive,sharer,webnews,domaintoolswhois,windows,wirefan,wishmindr,wordpress,raiseyourvoice,wykop,xanga,xing,yahoomail,yammer,yardbarker,yigg,yookos,yoolink,yorumcuyum,youmob,yummly,yuuby,zakladoknet,ziczac,zingme'
}
$(".share_btn").on("click", function() {
addthis.update('share', 'url', 'http://google.com');
addthis_sendto('more');
});
</script>
The Stack Snippet doesn't appear to work so to see this in action please see this JSFiddle.
On mobile browsers, you should use TouchEvents.
Try adding touchstart here:
$(".sharing").on("click touchstart", function () {
...
});
Is in every mobile or just iOS? If only on ios try this:
$(document).ready(function() {
var $ua = navigator.userAgent;
var $event = ($ua.match(/(iPod|iPhone|iPad)/i)) ? "touchstart" : "click";
$(document).on($event, function(ev) {
addthis.update('share', 'url', 'http://google.com');
addthis_sendto('more');
});
});
Good question! Unfortunately, AddThis was a fly-by-night operation, and they have ceased operation as a social-sharing service. If you go to their website now, and check the main page, you'll see that they are now a development company selling a list of links to social share sites.
In fact, this is the headline you will see at the addthis.com website if you visit it right now:
Free Website Tools
And, in addition:
AddThis is known for our beautifully simple share buttons.
This is interesting. A site that was once a social network, but now is selling services for other social networks. To add to the misfortune, all of their demos appear to be blank, lorem-ipsum html pages.
I would not say that this is a reliable service to be implementing at the moment!
I maintain a social sharing URLs GitHub project! We USED to implement AddThis, but our testing suite caught this bug and we have since removed it from our project. Want certainty and reliability along with your social sharing? Then check us out! GitHub: Social Share URLs.

Change URL of a saved HTML file

I am new to HTML so this question might sound a bit lame. Anyways I have a saved webpage on my desktop that when i open it in google chrome i want it to show a specific URL instead of its current location. Any ideas how i might get this to work?
I tried using the history.pushState but i have no idea why it is not working. I created a simple page for now to test it:
<html>
<head>
<script>
function setURL()
{
history.pushState("Test","page2", "www.test.com");
}
</script>
</head>
<body>
<button type="button" onclick="setURL()">Set Url</button>
</body>
</html>
Any help would be greatly appreciated. Thank you
I think you've misunderstood how it works. It's used to change the page location, without reloading the content, on the same domain. For example: you're on the index. Then you click the "about" page, it will change the url from www.hello.com to www.hello.com/about.
With additional JS in use, you could make it load the changes to make it look like the about page without loading the entire thing (but this is unrelated to what you want; just explaining an application for it.)
It does not allow for complete URL overwriting and your desktop file is not considered to be the same domain as your website (security limitation).
If this is to fool someone: you won't be able to do it.

WebBrowser Control in Silverlight 5 xaml view issues using some javascript

I have an OOB silverlight application. I have Silverlight 5 developer runtime and all the silverlight 5 developer tools installed. The OOB Application has a silverlight view with a WebBrowser control on it. The Source that of webBrowser control is this aspx page:
<head>
<title></title>
<script type="text/javascript" language="javascript">
function test() {
if (hiddenDiv.style.display == "none")
hiddenDiv.style.display = "block";
else
hiddenDiv.style.display = "none";
}
function handCursor() {
clickTest.style.cursor = "hand";
}
function defaultCursor() {
clickTest.style.cursor = "default";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<%--This Link Doesn't Work--%>
Javascript Href test</br>
<%--This Link Works--%>
<a id="clickTest" onclick="test()" onmouseover="handCursor()" onmouseout="defaultCursor()" style="text-decoration: underline; color:Blue">OnClick Test</a>
<div id="hiddenDiv" style="display:none; background-color:Black">
<span style="color:White; display:inherit">Look at me!</span>
</div>
</div>
</form></body>
(Note: Yes I know the above code is not complete HTML. I could not get the editor to display the full page properly. I cut off the html tags. Also note that this is just a test page, not the real page I want to display in my app. I was just trying to isolate the problem).
When the above code is run in IE9 it works just fine. The links make the Div called "hiddenDiv" hide and show. When it is displayed in a WebBrowser control in a silverlight app it works fine on another developer's machine, but on my machine it does not. I click the link and nothing happens. It appears that the javascript simply does not execute. It appears to only have this issue using the href=javascript method. onclick works great. Unfortunately I don't own the pages i want to display in my app and cannot change the code.
A co-worker of mine believes that this issue might be due to my mistakenly installing the standard silverlight 5 runtime before realizing my mistake and installing the developer runtime. Even though I have since removed the offending file and reinstalled the Silverlight5 Tools.exe. In fact I uninstalled and re-installed all silverlight related products (except VS 2010) and uninstalled IE 9. All to no avail.
If anyone has any additional information on this problem please let me know. We need a solution that does not involve modifying the html. I dont control that html. I am hoping to embed an external web application in my OOB SL application by simply displaying it in a web browser control inside my application.
I discovered the answer to this issue on this thread:
FEATURE_SCRIPTURL_MITIGATION
The issue is a registry setting that turns elements of javascript execution on and off. It is also described in this MSDN Article:

I have found that just before the </head> tag I have <script id="__isTpiViewExists"></script>. Is this a virus?

In the HTML code just before the </head> tag I have this:
<script id="__isTpiViewExists"></script>
I never put it there. Is it possible to be a virus or something else?
Edit //
By using google chrome debugging tool in the Scripts section i have everypage_early.js // This content script get injected into every page, enabling us to inject the conduit commmunity toolbar into the DOM of the page.
Another note : In Firefox using firebug i dont have this script only when I use google chrome debugging tool,also if I right click and View Page Source.I dont have the script only in google chrome debugging tool.. so i think is not a virus just google add in there tool .. i dont know
This is the nasty nasty conduit toolbar which injects javascript into every page it visits in order to hjiack the behvaiour. If you see this, run MalwareBytes and another AV and uninstall all toolbars and update your system.

Adding favicon to javascript Bookmarklet (uses window.open)

I have a bookmarklet that launches a window.open javascript function to open a small window with my bookmarklet -- an external feature used to communicate between any visted site and my server. I'd like for a favicon to show up when the bookmarklet is added to the bookmark toolbar. I realize that the bookmarklet is javascript, there is no domain tied to it so it's going to be either difficult or impossible to achieve this goal.
My understanding of the problem:
Favicons are easy to understand, a link within the head of an HTML doc. The browser can pull this when bookmarking an actual site by reference. However, as you see my bookmarklet is ran off a javascript launch code where there exists no HTML, therefor no link to a favicon. I'm not ready to give up yet though, I feel that there's some injection that can be made...
As of now, the bookmarklet launch code looks like this:
Current Script -- bookmarklet, no favicon (note all code is formated with line breaks -- won't work in all browsers, normally its one line)
javascript:void(window.open(
'http://mydomain.com/bookmarklet/form?u='
+encodeURIComponent(location.href)+
't='+encodeURIComponent(document.title),
'test','status=0,toolbar=0,location=0,menubar=0,
resizable=false,scrollbars=false,height=379,width=379'
));
The closest thing I've found to a solution is as follows, but it doesn't open a new window -- just creates a new tab with the html as the page:
Working favicon, no bookmarklet window
javascript:'<!DOCTYPE html>
<html><head>
<title>Hello World</title>
<link rel="icon" type="image/png" href="http://www.tapper-ware.net/devel/js/JS.Bookmarklets/icons/next.png" />
</head>
<body>Hello World</body>
</html>';
I have tried a combination of the two but it didn't seem to use the icon. I'd be curious to know if anyone can see a type of workaround.. I think it could be possible, I just don't think it's set up correctly as I've been trying.
My hybrid of the two -- bookmarklet but no favicon
javascript:'<!DOCTYPE html>
<html><head>
<title>Hello World</title>
<link rel="icon" type="image/png" href="http://www.tapper-ware.net/devel/js/JS.Bookmarklets/icons/next.png" />
</head><body>Hello World</body></html>';
window.open('http://mydomain.com/bookmarklet/form?u='
+encodeURIComponent(location.href)+
'&t='+encodeURIComponent(document.title),
'test',
'status=0,toolbar=0,location=0,menubar=0,resizable=false,
scrollbars=false,height=379,width=379').void(0);
What I did was use the html structure before firing window.open(), this successfully opened my bookmarklet in a new window, but no favicon showed up for the bookmark icon.
Logical Solution:
My thoughts on this would be to have the bookmarklet point to a page that is simply an HTML file with a favicon link and the launch script in the <head>. However, I don't want this opening in a new tab with a blank HTML file that then launches a popup.. Workaround..?
There exists a similar question but I did not seem to find the answer I'm looking for:
How to have favicon / icon set when bookmarklet dragged to toolbar?
Source for the working javascript favicon (no bookmarklet however):
http://www.tapper-ware.net/blog/?p=97
I'd be interested in what your current knowledge/thoughts on this would be
I tried and retried, and my first conclusion was: "It can't be done (at least not in FF4 on Ubuntu 11.04)". You need (I guess) a simple solution for your site visitors (drag&drop, add bookmark with 1 click ...).
I have found a workaround, it does it's job, but it is a little buggy (maybe someone can help fix it).
PROS:
add a icon to the bookmarklet
it uses windows.open
doesn't leave empty pages behind
CONS:
it reloads the current page (instead of leave a page behind)
Can't make Firefox POP-ul blocker allow "javascript:" generated HTML page to load POP-ups, so you need to hit allow every time
This is the code:
Bookmarklet
This is a link that you put on your page, the user needs to drag&drop this link to the bookmark bar (you can use something like Add Bookmark Script for adding it as a bookmark with 1 click), The bookmark has no icon until the user click's it at least once.
So how it supose to work:
1. redirect the user to the generated HTML page from the bookmarklet (that makes the ICON posible)
2. onLoad open the window you need using "windows.open"
3. redirect the page back using "history.back(-1)"
In theory everithing happens so fast, that the user does't see the new page, just that the current page is reloading, and a new windows appear.
The problem:
1. I use setTimeout for history.back beacause window.open is blocked by Firefox, so I need to click allow every single time (if somebody can fix this ... we have a chance of using this, develop it further :) )
I know THIS is not a reliable solution, but this is the only solution I've got so far.
Hope this helps a little. :)
Some of the things that I've tried that might possibly get you going a bit more:
Append a new link element to the current document:
javascript: var newLink = document.createElement('link');
newLink.setAttribute('rel','icon');
newLink.setAttribute('type','image/png');
newLink.setAttribute('href','http://www.tapper-ware.net/devel/js/JS.Bookmarklets/icons/next.png');
document.querySelector('head').appendChild(newLink);
void(0);
Note that I was using the querySelector due to IE testing (though works in modern browsers as well). With Chrome and FF, I kept getting invalid character when trying to create the element, so I had to do piecewise attribute setting.
Tried using base64 encoded image string using the "data:image/png;base64,iVBORw0KGgoAAAA..." URI schema, but that didn't help anything due to the fact that I still had to set it to the current HTML text (which I could do, but ran into the same problem as you above of no bookmarklet).
Maybe this can't be done due to cross site scripting concerns? Not sure... Either way, really curious to see what you come up with (if you manage to come up with anything).
"I don't want this opening in a new tab with a blank HTML file that then launches a popup.. Workaround..?"
If what you after really is the visual effect, you can try launch the blank HTML in hidden iframe, then launch the javascript.
Hope that helps

Categories