Stop pop-ups with URL - html

I've been asked a question, and don't know if there is an answer.
"do you know if there is some code you can put into URLs to block pop-ups?"
This isn't using pop-up blocking software or toolbars etc, but a parameter in the URL. Almost opposite to the target="_blank" for instance.

Assuming I'm reading your question right, it sounds like you want to block people from being able to open links in new windows/tabs within your site? There is nothing native in HTML you can do to block this. But you could use some javascript to do it:
Link
Now, mind you, this really breaks the way the anchor tag is supposed to work and presents a number of problems. If someone has javascript disabled, they can't use any of your links. I'd assume it'll also present problems for search-engine spiders as I doubt they follow javascript logic like that.
I'd personally avoid implementing something like this though and hate any site that went out of it's way to prevent me from opening a link in a new tab.

You can't do it for pages that aren't yours unless you're using a popup blocker.
If you're talking about making sure your own site doesn't open links in a new window you can do something like this within the <head> and </head> tags:
<base target="_self" />
However, I'm pretty sure this is the default anyway and will not keep a link that manually has it's target="_blank" from opening in a new window so I doubt it'll do you any good.

Related

Can I override the title of a bookmark for a web page?

This question has been asked before by someone else entirely, but basically no solution was given (and this was in 2008). Now, in 2013, HTML and browser functionality has increased, so I thought maybe it's a good idea to ask.
Question:
As a developer, how can you make sure that the title of the web page is different from the title of when someone bookmarks your page?
The reason I ask is because there are many websites that have their title, and then some slogan. Or worse, the slogan first and the actual site title after that. In any case, the titles are long, and you want your bookmarks to be concise, preferably one word, right? I want to know if there's any kind of functionality like that available in modern browsers.
As far as I can tell for Internet Explorer you can add a link, perhaps in the footer, for your visitors to click and bookmark your site and edit the default title with this function AddFavorite().
Here is a link to it on MSDN. Please notice that this function is deprecated.
See the demonstration of use below:
<a href="#"
onclick="window.external.AddFavorite(location.href, 'YOUR_TITLE_HERE');
return false">
Bookmark this!
</a>
Although this won't work on other browsers as far as I am aware (surely won't work on Chrome and Firefox) and it's use is abolished when a user decides to bookmark your site manually instead of clicking the link.

Prevent site configuration info from showing up on Google

I have a site that's running WordPress.
The main page has an embedded Flash player and an imbedded iframe, and for some reason, all the configuration info from the Flash player is showing up on Google for my site, and nothing else.
How can I have the main site information show up on Google, without having that Flash player config info show up?
And can I customize what shows up at all?
If there's some way to tag the info I don't want to show up, or tag the info I want to show up, I can probably do most ofthe edits myself, I just don't know where to start...
EDIT: I tried most of the suggestions below, and I didn't get anywhere...
Any other ideas?
Thanks a lot!
If you don't want Google, or other crawler to access certain parts of your website you should use a robots.txt file. Inside you specify which parts are accessible and which aren't, when the crawlers get to your website will always look for this file for instructions.
You can check some documentation on how to do it here and here
In order to influence what text is used on the google search result try putting this within your head tags
<meta name="description" content="WHATEVER YOU WANT DISPLAYED ON GOOGLE">
Source: http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/en/us/webmasters/docs/search-engine-optimization-starter-guide.pdf
Some more information from google on controling parts of a page. Apparently there are google off/google on tags.
http://perishablepress.com/press/2009/08/23/tell-google-to-not-index-certain-parts-of-your-page/
Hope this helps.
If you want Google to index only part of your pages, you can't follow normal SEO routines. You should provide a mechanism to understand whether the current client (requester) is a robot or not. If yes, then don't render that part. This is the only way. Otherwise, a robot either gets the whole rendered content, or doesn't have access based on robots.txt file (Robot Exclusion Protocol).
Another way (which is not really smart, and can't be guaranteed to work) is to dynamically inject your content into the page via JavaScript. Because AMAIK, robots don't run JavaScript.
As search spiders won't render javascript generated markup (JS is not run as it is client-side in the browser), a quick fix would be to don't output any of flash / markup initially in the HTML document and then use JS to add the flash stuff on load.
Note: as far as I'm aware, Google is currently testing a JS reading spider so this may not work long term.
Google is returning this data because it simply can't find any content where it normally would. Search engines require content - they're not advanced enough to process your multimedia to determine what it's all about.
Google will IGNORE your meta description if it doesn't feel that it reflects your page content (of which there is only iframes and JS)
Use SWFObject to provide alternate content for users without flash (including search engines) - ensure it's not some dinky text like "download flash here" - but a lengthy descriptive content piece about your site or media that they would normally experience if they could experience.
Use robots.txt or <meta name="robots" content="noindex,follow"> for the iframe content to prevent it from being indexed.
For the love of all things holy, please look at reducing the number of JS files and inline JS on your site (i'd recommend WP-minify since it's so obvious that you love plugins)

Direct page to other page

I am using HTML and would like to know why when I enter
<a class="button flip" href="index2.html">List View</a>
it tries to find the original_page_url#index2.html
thanks
Charlene
From that code that you've put it shouldn't be doing that which means something else on your page is doing that. Javascript is the most likely culprit since it can easily change where your link actually goes. There may be other ways this could happen but I'd look at your javascript.
If you post a full page repro of the problem that we can use to understand the problem better that would help a lot. Preferably cutting out all the superfluous stuff on your page so its not too big. ;-)
Without further information from you, the only three things I can think of that would cause that are:
1) Your href in your question is different than your actual source, and there is a # sign before the index2.html in the a link. However, I'll assume you gave the correct href code above, in which case...
2) Some javascript on the page is automatically making that link act as an internal page link and adding the # itself. Make sure you don't have any javascript on the page that might be doing that.
3) The server has a rewrite rule that affects your links and appends them with the # sign. That would be rather odd, however.

Enlarging Image in New Window?

I just did a quick search for my question and couldn't find anything directly on point.
I'm still very new to HTML and was wondering if someone could tell me how I could add a picture to my website and set the code so that if I click on it, it enlarges the picture in a new window.
I'm going to be adding around 600+ pics to my website so I was also wondering if there's a way to write the code once and have it apply to all the pics I add.
Thanks in advance,
- Danny B.
There's many many ways in which you could do this. The basic HTML for inserting an image with a link to a new window will be:
<a href="enlarged.html" target="_blank">
<img src="photos/photo-name.jpg" />
</a>
But it is a fair bit more complicated if you want to be able to dynamically display a large number of photos. If you want to code this yourself, you'll want to look into using something like PHP to output the HTML code automatically for 600+ images. Then instead of pointing the link for each to a new page, you might want to consider having the images load in a cool way, such as a javascript lightbox/colorbox some of the other answers suggest.
One possible alternative solution might be to look for some pre-created photo album script. I don't have any experience of these so I'll let someone else make some suggestions on that.
There are several ways to do this, but I'm assuming you'll have a simple site with lots of images on one page, and you'd like the images to zoom open "in a cool way".
Check out this: http://colorpowered.com/colorbox/
... click on View Demonstration and then see the various photo handling options.
This needs just some basic HTML and minimally configured Jquery. Very simple to use and produces a nice effect.
Google around using the keyword lightbox. Most of the solutions are ready-to-use Javascripts. Just include once, assign some IDs/classes, execute during onload and that's it. I personally have good experiences with Lightbox2 and jQuery Lightbox plugin.
I decided to go w/ target="_blank" -- Lightbox2 seems like it'd be great, but I'm really not sure how to use it and where to put all the code. The instructions I've found for it still assume the user has some standard knowledge in the field, that of which I do not currently possess. So, I'll stick to the target/blank approach until I can get more familiar w/ coding and then I'll upgrade to Lightbox.
Once again, I want to say thanks to everyone. You guys always respond quickly and accurately.
With much appreciation,
- Danny B
The simplest way would be to add a link to it, and set the target attribute to target="_blank". The link should point to the image itself. This would regularly open a new tab though, if you want a whole new window, you should tryhref="javascript:window.open('myimage.png','_blank','toolbar=no,menubar=no,resizable=yes,scrollbars=yes')",which would open a new, standalone window. If you're looking for fade/resize effects and such, try one of the other answers posted.

When should you use target="_blank" on your links?

When are appropriate situations to use the target="_blank" attribute on your hyperlinks?
Edit:
To clarify, I know the syntax will open a new browser window. What I am asking is when is it appropriate to do so?
Whenever you want to annoy users.
More seriously, since this opens a new window/tab, it should be used sparingly, in my opinion.
Most modern browsers have some option (ie: middle-click on hyperlink) to do this for you, so I personally prefer allowing the user to handle this themselves.
However, if you are working on something where there is a non-technical reason for this, such as a sales-oriented site, it's often desirable to open a product brochure in a new window, or something along those lines. However, just be aware that overdoing this leads to my pseudo-joke response above....
When ever you want to leave the current page as-is.
I've got a feeling your question should be 'When is it appropriate to open a new tab or browser window?'
If so, the answer might be :
The current form may be in edit mode, and you want to be able to open
another page without either
disregarding or saving the current
one.
You have a data stream like Twitter which you want to leave active while
you go off and look at X.
There is a specific business requirement to do so.
Your users have weak navigation abilities and won't find their way back to the main page.
It is most appropriate when you're linking to outside resources that people may want to go to for additional information, reference, etc.
It lets them leave your site without losing their place on your page or have to use the back button.
It also makes sure they have to look at it one more time if they want to close it ;-)
(that last one is a joke and I don't advocate such despicable practices of course...)
Generally I avoid it like the plague. However, perhaps a good example of why you'd want to use that would be if you're building a cart module or something, and you have the "click for bigger picture" link. I think it's ok in that sense.
Keep in mind that whenever you do it, you're assuming you know the user's workflow better than they do (they can always open the link in a new window without you forcing it). In the case of the "bigger picture" link, you'd most likely be correct in assuming that's what they want, but in most cases I wouldn't jump to conclusions.
When you want the link to open in a new window, I would assume. I think the time to use this is when people might click on a link that'd destroy what they were doing on the page currently, such as a "help" link on a form.
Though some would argue that you should never use target="_blank".
One thing to be aware of here is accessibility. Built in features to help blind users (text to speech for example) may act weird (or just in a way that's confusing to the user) when you open a new window or tab.
Also, you're breaking the most used feature of every browser...the back button.
Only if it, with outmost certainty, prevents the user from having to repeat something.
I think that you should probably not ask a user experience question in a developer forum, because you will get developer answers.
That said, and as a developer, I open new Windows when I expect (or want) the user to come back and continue working on the site where the link originated.
The only time I would consider it is if you have multimedia on the page.
Best example I can think of - the StackOverflow podcast... I can't tell you how many times I've rushed to click a link in the blog post only to take me off the podcast page!
Also, on YouTube when I click "View Comments", it takes me away from the video page.
Whatever you do, don't use JavaScript to open a new window. That's definitely the worst. Nothing worse than a middle-click only to open a new tab with javascript::garbage in the address bar.
The target="_blank" is deprecated in XHTML 1.0 strict, and since I only write in strict I use JS if I really want to open a new page (or tab) and I only do that for external links (like a wiki or so).
More info:
http://www.ajaxblender.com/open-links-new-window-w3c-valid-target-blank.html
NOTE: Although it is deprecated in XHTML 1.0 strict, target="_blank" been brought back in HTML 5.
Stydying your audience will help you decide on this. Casual websurfers will appreciate target=_blank while tech-savvy people are more likely to get annoyed.
As for XHTML 1.0 strict, it is never appropriate. The target-attribute is deprecated in XHTML 1.0 strict.
Never. If I want to open your link in a new window I will do so.
When you open the link in a new window.
There exists practice to open in new window links that refer another/external domain (wiki for example).
I use it for product brochures and the like as I think it is useful for the customer to stay on the product page. I always indicate [new window] next to the link to keep the customer informed. Often the product brochure is a PDF, so I also note that the link will open a PDF.
Use it as you need it, but keep your users informed so as not to annoy/confuse them.
I prefer to avoid it, because most users can figure out on their own how to open a link in a new window, even if unsophisticated. My preference is to use an explicitly named destination, e.g. target="somename" if you have a good reason for opening a new window on your own.
I only use it when the client insists.
Otherwise I prefer to let the user decide.
I might be in the minority here but I like using target="_blank" for my links ONLY when they're meant to be reference links. In most cases, you shouldn't be using it for regular links around a website.
I really don't like it when I click on a link in a blog post or an article and it loads on the same page and I need to navigate back to the original source page.
When you are creating an email for mobile users and are linking to external content. That way, when they click on the link they will open the page in their browser.
When you want to open any particular link in new tab on current window then you can use target="_blank" in html.
<div class="restrunt-menu-list">
<ul>
<li>
<span>
<a target="_blank" href="www.example.com">View Menu</a></span>
</li>
</ul>
</div>
But It might affect your system performance because all browsers takes a lot of memory when it open a new tab or new window.
So less opened tab means less memory uses, less memory uses means better performance.
You can also see that which tab using how mach memory in chrome:
Press shift+Esc , Then you can see Task Manager- Chrome with list currently using memory by each tabs ( in chorme ).
For all external links...